Drop package facades: code cleanup in Kotlin project.

This commit is contained in:
Dmitry Petrov
2015-10-13 14:50:49 +03:00
parent 57869d85e8
commit 8cd624a58a
301 changed files with 1285 additions and 1362 deletions
@@ -42,11 +42,12 @@ import org.jetbrains.kotlin.lexer.JetToken;
import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.BindingContextUtils;
import org.jetbrains.kotlin.resolve.BindingTrace;
import org.jetbrains.kotlin.resolve.CompileTimeConstantUtils;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.model.*;
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind;
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant;
@@ -270,7 +271,7 @@ public class JetControlFlowProcessor {
@NotNull
private AccessTarget getResolvedCallAccessTarget(JetElement element) {
ResolvedCall<?> resolvedCall = getResolvedCall(element, trace.getBindingContext());
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(element, trace.getBindingContext());
return resolvedCall != null ? new AccessTarget.Call(resolvedCall) : AccessTarget.BlackBox.INSTANCE$;
}
@@ -303,7 +304,7 @@ public class JetControlFlowProcessor {
@Override
public void visitThisExpression(@NotNull JetThisExpression expression) {
ResolvedCall<?> resolvedCall = getResolvedCall(expression, trace.getBindingContext());
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(expression, trace.getBindingContext());
if (resolvedCall == null) {
createNonSyntheticValue(expression, MagicKind.UNRESOLVED_CALL);
return;
@@ -325,7 +326,7 @@ public class JetControlFlowProcessor {
@Override
public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression) {
ResolvedCall<?> resolvedCall = getResolvedCall(expression, trace.getBindingContext());
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(expression, trace.getBindingContext());
if (resolvedCall instanceof VariableAsFunctionResolvedCall) {
VariableAsFunctionResolvedCall variableAsFunctionResolvedCall = (VariableAsFunctionResolvedCall) resolvedCall;
generateCall(variableAsFunctionResolvedCall.getVariableCall());
@@ -360,7 +361,7 @@ public class JetControlFlowProcessor {
visitAssignment(left, getDeferredValue(right), expression);
}
else if (OperatorConventions.ASSIGNMENT_OPERATIONS.containsKey(operationType)) {
ResolvedCall<?> resolvedCall = getResolvedCall(expression, trace.getBindingContext());
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(expression, trace.getBindingContext());
if (resolvedCall != null) {
PseudoValue rhsValue = generateCall(resolvedCall).getOutputValue();
Name assignMethodName = OperatorConventions.getNameForOperationSymbol((JetToken) expression.getOperationToken());
@@ -467,7 +468,7 @@ public class JetControlFlowProcessor {
Map<PseudoValue, ReceiverValue> receiverValues = SmartFMap.emptyMap();
AccessTarget accessTarget = AccessTarget.BlackBox.INSTANCE$;
if (left instanceof JetSimpleNameExpression || left instanceof JetQualifiedExpression) {
accessTarget = getResolvedCallAccessTarget(PsiUtilPackage.getQualifiedElementSelector(left));
accessTarget = getResolvedCallAccessTarget(JetPsiUtilKt.getQualifiedElementSelector(left));
if (accessTarget instanceof AccessTarget.Call) {
receiverValues = getReceiverValues(((AccessTarget.Call) accessTarget).getResolvedCall());
}
@@ -602,7 +603,7 @@ public class JetControlFlowProcessor {
}
boolean incrementOrDecrement = isIncrementOrDecrement(operationType);
ResolvedCall<?> resolvedCall = getResolvedCall(expression, trace.getBindingContext());
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(expression, trace.getBindingContext());
PseudoValue rhsValue;
if (resolvedCall != null) {
@@ -1472,7 +1473,7 @@ public class JetControlFlowProcessor {
private boolean generateCall(@Nullable JetElement callElement) {
if (callElement == null) return false;
return checkAndGenerateCall(getResolvedCall(callElement, trace.getBindingContext()));
return checkAndGenerateCall(CallUtilKt.getResolvedCall(callElement, trace.getBindingContext()));
}
private boolean checkAndGenerateCall(@Nullable ResolvedCall<?> resolvedCall) {
@@ -30,10 +30,7 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
import org.jetbrains.kotlin.cfg.PseudocodeVariablesData.VariableControlFlowState;
import org.jetbrains.kotlin.cfg.PseudocodeVariablesData.VariableUseState;
import org.jetbrains.kotlin.cfg.pseudocode.PseudoValue;
import org.jetbrains.kotlin.cfg.pseudocode.Pseudocode;
import org.jetbrains.kotlin.cfg.pseudocode.PseudocodePackage;
import org.jetbrains.kotlin.cfg.pseudocode.PseudocodeUtil;
import org.jetbrains.kotlin.cfg.pseudocode.*;
import org.jetbrains.kotlin.cfg.pseudocode.instructions.Instruction;
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitor;
import org.jetbrains.kotlin.cfg.pseudocode.instructions.JetElementInstruction;
@@ -44,7 +41,7 @@ import org.jetbrains.kotlin.cfg.pseudocode.instructions.special.MarkInstruction;
import org.jetbrains.kotlin.cfg.pseudocode.instructions.special.SubroutineExitInstruction;
import org.jetbrains.kotlin.cfg.pseudocode.instructions.special.VariableDeclarationInstruction;
import org.jetbrains.kotlin.cfg.pseudocodeTraverser.Edges;
import org.jetbrains.kotlin.cfg.pseudocodeTraverser.PseudocodeTraverserPackage;
import org.jetbrains.kotlin.cfg.pseudocodeTraverser.PseudocodeTraverserKt;
import org.jetbrains.kotlin.cfg.pseudocodeTraverser.TraversalOrder;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptorKt;
@@ -55,10 +52,10 @@ import org.jetbrains.kotlin.idea.MainFunctionDetector;
import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.*;
import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilPackage;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilsKt;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.calls.resolvedCallUtil.ResolvedCallUtilPackage;
import org.jetbrains.kotlin.resolve.calls.resolvedCallUtil.ResolvedCallUtilKt;
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils;
@@ -311,7 +308,7 @@ public class JetFlowInformationProvider {
final Map<Instruction, DiagnosticFactory<?>> reportedDiagnosticMap = Maps.newHashMap();
PseudocodeTraverserPackage.traverse(
PseudocodeTraverserKt.traverse(
pseudocode, FORWARD, initializers,
new InstructionDataAnalyzeStrategy<Map<VariableDescriptor, VariableControlFlowState>>() {
@Override
@@ -424,7 +421,7 @@ public class JetFlowInformationProvider {
DeclarationDescriptor descriptor = BindingContextUtils.getEnclosingDescriptor(trace.getBindingContext(), expression);
PropertySetterDescriptor setterDescriptor = ((PropertyDescriptor) variableDescriptor).getSetter();
ResolvedCall<? extends CallableDescriptor> resolvedCall = CallUtilPackage.getResolvedCall(expression, trace.getBindingContext());
ResolvedCall<? extends CallableDescriptor> resolvedCall = CallUtilKt.getResolvedCall(expression, trace.getBindingContext());
ReceiverValue receiverValue = ReceiverValue.IRRELEVANT_RECEIVER;
if (resolvedCall != null) {
receiverValue = ExpressionTypingUtils
@@ -708,7 +705,7 @@ public class JetFlowInformationProvider {
}
}
};
PseudocodeTraverserPackage.traverse(pseudocode, TraversalOrder.BACKWARD, variableStatusData, variableStatusAnalyzeStrategy);
PseudocodeTraverserKt.traverse(pseudocode, TraversalOrder.BACKWARD, variableStatusData, variableStatusAnalyzeStrategy);
}
////////////////////////////////////////////////////////////////////////////////
@@ -716,7 +713,7 @@ public class JetFlowInformationProvider {
public void markUnusedExpressions() {
final Map<Instruction, DiagnosticFactory<?>> reportedDiagnosticMap = Maps.newHashMap();
PseudocodeTraverserPackage.traverse(
PseudocodeTraverserKt.traverse(
pseudocode, FORWARD, new JetFlowInformationProvider.FunctionVoid1<Instruction>() {
@Override
public void execute(@NotNull Instruction instruction) {
@@ -725,8 +722,8 @@ public class JetFlowInformationProvider {
JetElement element = ((JetElementInstruction)instruction).getElement();
if (!(element instanceof JetExpression)) return;
if (BindingContextUtilPackage.isUsedAsStatement((JetExpression) element, trace.getBindingContext())
&& PseudocodePackage.getSideEffectFree(instruction)) {
if (BindingContextUtilsKt.isUsedAsStatement((JetExpression) element, trace.getBindingContext())
&& PseudocodeUtilsKt.getSideEffectFree(instruction)) {
VariableContext ctxt = new VariableContext(instruction, reportedDiagnosticMap);
report(
element instanceof JetFunctionLiteralExpression
@@ -744,7 +741,7 @@ public class JetFlowInformationProvider {
// Statements
public void markStatements() {
PseudocodeTraverserPackage.traverse(
PseudocodeTraverserKt.traverse(
pseudocode, FORWARD, new JetFlowInformationProvider.FunctionVoid1<Instruction>() {
@Override
public void execute(@NotNull Instruction instruction) {
@@ -762,7 +759,7 @@ public class JetFlowInformationProvider {
}
public void markWhenWithoutElse() {
PseudocodeTraverserPackage.traverse(
PseudocodeTraverserKt.traverse(
pseudocode, FORWARD, new JetFlowInformationProvider.FunctionVoid1<Instruction>() {
@Override
public void execute(@NotNull Instruction instruction) {
@@ -810,7 +807,7 @@ public class JetFlowInformationProvider {
}
}
final Map<JetElement, KindAndCall> calls = new HashMap<JetElement, KindAndCall>();
PseudocodeTraverserPackage.traverse(
PseudocodeTraverserKt.traverse(
pseudocode,
FORWARD,
new FunctionVoid1<Instruction>() {
@@ -818,7 +815,7 @@ public class JetFlowInformationProvider {
if (!(instruction instanceof CallInstruction)) return;
CallInstruction callInstruction = (CallInstruction) instruction;
ResolvedCall<?> resolvedCall = getResolvedCall(callInstruction.getElement(), trace.getBindingContext());
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(callInstruction.getElement(), trace.getBindingContext());
if (resolvedCall == null) return;
// is this a recursive call?
@@ -839,7 +836,7 @@ public class JetFlowInformationProvider {
return;
}
boolean isTail = PseudocodeTraverserPackage.traverseFollowingInstructions(
boolean isTail = PseudocodeTraverserKt.traverseFollowingInstructions(
callInstruction,
new HashSet<Instruction>(),
FORWARD,
@@ -853,7 +850,7 @@ public class JetFlowInformationProvider {
// }
// }
boolean sameDispatchReceiver =
ResolvedCallUtilPackage.hasThisOrNoDispatchReceiver(resolvedCall, trace.getBindingContext());
ResolvedCallUtilKt.hasThisOrNoDispatchReceiver(resolvedCall, trace.getBindingContext());
TailRecursionKind kind = isTail && sameDispatchReceiver ? TAIL_CALL : NON_TAIL;
@@ -25,7 +25,8 @@ import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.BindingTrace;
import org.jetbrains.kotlin.resolve.CompileTimeConstantUtils;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilPackage;
import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilsKt;
import org.jetbrains.kotlin.types.FlexibleTypesKt;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.TypeUtils;
@@ -34,7 +35,6 @@ import java.util.Set;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isEnumEntry;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isEnumClass;
import static org.jetbrains.kotlin.types.TypesPackage.isFlexible;
public final class WhenChecker {
private WhenChecker() {
@@ -44,7 +44,7 @@ public final class WhenChecker {
JetType expectedType = trace.get(BindingContext.EXPECTED_EXPRESSION_TYPE, expression);
boolean isUnit = expectedType != null && KotlinBuiltIns.isUnit(expectedType);
// Some "statements" are actually expressions returned from lambdas, their expected types are non-null
boolean isStatement = BindingContextUtilPackage.isUsedAsStatement(expression, trace.getBindingContext()) && expectedType == null;
boolean isStatement = BindingContextUtilsKt.isUsedAsStatement(expression, trace.getBindingContext()) && expectedType == null;
return !isUnit && !isStatement && !isWhenExhaustive(expression, trace);
}
@@ -173,7 +173,7 @@ public final class WhenChecker {
}
if (exhaustive) {
if (// Flexible (nullable) enum types are also counted as exhaustive
(enumClassDescriptor != null && isFlexible(type))
(enumClassDescriptor != null && FlexibleTypesKt.isFlexible(type))
|| containsNullCase(expression, trace)
|| !isNullableTypeWithoutPossibleSmartCast(expression.getSubjectExpression(), type, trace.getBindingContext())) {
@@ -32,7 +32,7 @@ import org.jetbrains.kotlin.cfg.pseudocode.instructions.special.LocalFunctionDec
import org.jetbrains.kotlin.cfg.pseudocode.instructions.special.SubroutineEnterInstruction;
import org.jetbrains.kotlin.cfg.pseudocode.instructions.special.SubroutineExitInstruction;
import org.jetbrains.kotlin.cfg.pseudocode.instructions.special.SubroutineSinkInstruction;
import org.jetbrains.kotlin.cfg.pseudocodeTraverser.PseudocodeTraverserPackage;
import org.jetbrains.kotlin.cfg.pseudocodeTraverser.PseudocodeTraverserKt;
import org.jetbrains.kotlin.psi.JetElement;
import java.util.*;
@@ -181,13 +181,13 @@ public class PseudocodeImpl implements Pseudocode {
@Override
public List<Instruction> getReversedInstructions() {
LinkedHashSet<Instruction> traversedInstructions = Sets.newLinkedHashSet();
PseudocodeTraverserPackage.traverseFollowingInstructions(sinkInstruction, traversedInstructions, BACKWARD, null);
PseudocodeTraverserKt.traverseFollowingInstructions(sinkInstruction, traversedInstructions, BACKWARD, null);
if (traversedInstructions.size() < instructions.size()) {
List<Instruction> simplyReversedInstructions = Lists.newArrayList(instructions);
Collections.reverse(simplyReversedInstructions);
for (Instruction instruction : simplyReversedInstructions) {
if (!traversedInstructions.contains(instruction)) {
PseudocodeTraverserPackage.traverseFollowingInstructions(instruction, traversedInstructions, BACKWARD, null);
PseudocodeTraverserKt.traverseFollowingInstructions(instruction, traversedInstructions, BACKWARD, null);
}
}
}
@@ -243,7 +243,7 @@ public class PseudocodeImpl implements Pseudocode {
addValueUsage(mergedValue, instruction);
}
}
if (PseudocodePackage.calcSideEffectFree(instruction)) {
if (PseudocodeUtilsKt.calcSideEffectFree(instruction)) {
sideEffectFree.add(instruction);
}
}
@@ -421,7 +421,7 @@ public class PseudocodeImpl implements Pseudocode {
private Set<Instruction> collectReachableInstructions() {
Set<Instruction> visited = Sets.newHashSet();
PseudocodeTraverserPackage.traverseFollowingInstructions(getEnterInstruction(), visited, FORWARD, null);
PseudocodeTraverserKt.traverseFollowingInstructions(getEnterInstruction(), visited, FORWARD, null);
if (!visited.contains(getExitInstruction())) {
visited.add(getExitInstruction());
}
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.BindingContextUtils;
import org.jetbrains.kotlin.resolve.BindingTrace;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.calls.resolvedCallUtil.ResolvedCallUtilPackage;
import org.jetbrains.kotlin.resolve.calls.resolvedCallUtil.ResolvedCallUtilKt;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice;
import org.jetbrains.kotlin.util.slicedMap.WritableSlice;
@@ -117,6 +117,6 @@ public class PseudocodeUtil {
"AccessTarget.Declaration has no receivers and it's not BlackBox, so it should be Call";
ResolvedCall<?> accessResolvedCall = ((AccessTarget.Call) accessTarget).getResolvedCall();
return ResolvedCallUtilPackage.hasThisOrNoDispatchReceiver(accessResolvedCall, bindingContext);
return ResolvedCallUtilKt.hasThisOrNoDispatchReceiver(accessResolvedCall, bindingContext);
}
}
@@ -34,9 +34,9 @@ import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.BindingContextUtils;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.calls.tasks.TasksPackage;
import org.jetbrains.kotlin.resolve.calls.tasks.DynamicCallsKt;
import org.jetbrains.kotlin.types.ErrorUtils;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.util.slicedMap.WritableSlice;
@@ -127,7 +127,7 @@ public class DebugInfoUtil {
@Override
public void visitThisExpression(@NotNull JetThisExpression expression) {
ResolvedCall<? extends CallableDescriptor> resolvedCall = CallUtilPackage.getResolvedCall(expression, bindingContext);
ResolvedCall<? extends CallableDescriptor> resolvedCall = CallUtilKt.getResolvedCall(expression, bindingContext);
if (resolvedCall != null) {
reportIfDynamic(expression, resolvedCall.getResultingDescriptor(), debugInfoReporter);
}
@@ -225,7 +225,7 @@ public class DebugInfoUtil {
}
private static boolean reportIfDynamic(JetElement element, DeclarationDescriptor declarationDescriptor, DebugInfoReporter debugInfoReporter) {
if (declarationDescriptor != null && TasksPackage.isDynamic(declarationDescriptor)) {
if (declarationDescriptor != null && DynamicCallsKt.isDynamic(declarationDescriptor)) {
debugInfoReporter.reportDynamicCall(element, declarationDescriptor);
return true;
}
@@ -21,8 +21,6 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters1;
import org.jetbrains.kotlin.renderer.Renderer;
import static org.jetbrains.kotlin.diagnostics.rendering.RenderingPackage.renderParameter;
public class DiagnosticWithParameters1Renderer<A> extends AbstractDiagnosticWithParametersRenderer<DiagnosticWithParameters1<?, A>> {
private final Renderer<? super A> rendererForA;
@@ -34,6 +32,6 @@ public class DiagnosticWithParameters1Renderer<A> extends AbstractDiagnosticWith
@NotNull
@Override
public Object[] renderParameters(@NotNull DiagnosticWithParameters1<?, A> diagnostic) {
return new Object[]{renderParameter(diagnostic.getA(), rendererForA)};
return new Object[]{DiagnosticRendererUtilKt.renderParameter(diagnostic.getA(), rendererForA)};
}
}
@@ -21,8 +21,6 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters2;
import org.jetbrains.kotlin.renderer.Renderer;
import static org.jetbrains.kotlin.diagnostics.rendering.RenderingPackage.renderParameter;
public class DiagnosticWithParameters2Renderer<A, B> extends AbstractDiagnosticWithParametersRenderer<DiagnosticWithParameters2<?, A, B>> {
private final Renderer<? super A> rendererForA;
private final Renderer<? super B> rendererForB;
@@ -37,7 +35,7 @@ public class DiagnosticWithParameters2Renderer<A, B> extends AbstractDiagnosticW
@Override
public Object[] renderParameters(@NotNull DiagnosticWithParameters2<?, A, B> diagnostic) {
return new Object[]{
renderParameter(diagnostic.getA(), rendererForA),
renderParameter(diagnostic.getB(), rendererForB)};
DiagnosticRendererUtilKt.renderParameter(diagnostic.getA(), rendererForA),
DiagnosticRendererUtilKt.renderParameter(diagnostic.getB(), rendererForB)};
}
}
@@ -21,8 +21,6 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters3;
import org.jetbrains.kotlin.renderer.Renderer;
import static org.jetbrains.kotlin.diagnostics.rendering.RenderingPackage.renderParameter;
public class DiagnosticWithParameters3Renderer<A, B, C> extends AbstractDiagnosticWithParametersRenderer<DiagnosticWithParameters3<?, A, B, C>> {
private final Renderer<? super A> rendererForA;
private final Renderer<? super B> rendererForB;
@@ -42,8 +40,8 @@ public class DiagnosticWithParameters3Renderer<A, B, C> extends AbstractDiagnost
@Override
public Object[] renderParameters(@NotNull DiagnosticWithParameters3<?, A, B, C> diagnostic) {
return new Object[]{
renderParameter(diagnostic.getA(), rendererForA),
renderParameter(diagnostic.getB(), rendererForB),
renderParameter(diagnostic.getC(), rendererForC)};
DiagnosticRendererUtilKt.renderParameter(diagnostic.getA(), rendererForA),
DiagnosticRendererUtilKt.renderParameter(diagnostic.getB(), rendererForB),
DiagnosticRendererUtilKt.renderParameter(diagnostic.getC(), rendererForC)};
}
}
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.psi.JetFile;
import org.jetbrains.kotlin.psi.JetNamedFunction;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.TypeProjection;
import org.jetbrains.kotlin.types.Variance;
@@ -108,7 +108,7 @@ public class MainFunctionDetector {
DeclarationDescriptor containingDeclaration = functionDescriptor.getContainingDeclaration();
return containingDeclaration instanceof ClassDescriptor
&& ((ClassDescriptor) containingDeclaration).getKind().isSingleton()
&& AnnotationsPackage.hasPlatformStaticAnnotation(functionDescriptor);
&& AnnotationUtilKt.hasPlatformStaticAnnotation(functionDescriptor);
}
@Nullable
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.TestOnly;
import org.jetbrains.kotlin.lexer.JetKeywordToken;
import org.jetbrains.kotlin.lexer.JetToken;
import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.utils.strings.StringsPackage;
import org.jetbrains.kotlin.utils.strings.StringsKt;
import java.util.HashMap;
import java.util.Map;
@@ -488,6 +488,6 @@ import static org.jetbrains.kotlin.lexer.JetTokens.*;
@SuppressWarnings("UnusedDeclaration")
@TestOnly
public String currentContext() {
return StringsPackage.substringWithContext(myBuilder.getOriginalText(), myBuilder.getCurrentOffset(), myBuilder.getCurrentOffset(), 20);
return StringsKt.substringWithContext(myBuilder.getOriginalText(), myBuilder.getCurrentOffset(), myBuilder.getCurrentOffset(), 20);
}
}
@@ -20,10 +20,8 @@ import com.intellij.lang.ASTNode;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.JetNodeTypes;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class JetAnnotatedExpression extends JetExpressionImpl implements JetAnnotated, JetAnnotationsContainer {
@@ -50,6 +48,6 @@ public class JetAnnotatedExpression extends JetExpressionImpl implements JetAnno
@Override
@NotNull
public List<JetAnnotationEntry> getAnnotationEntries() {
return PsiUtilPackage.collectAnnotationEntriesFromStubOrPsi(this);
return JetPsiUtilKt.collectAnnotationEntriesFromStubOrPsi(this);
}
}
@@ -22,8 +22,8 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.JetNodeTypes;
import org.jetbrains.kotlin.kdoc.psi.api.KDoc;
import org.jetbrains.kotlin.lexer.JetModifierKeywordToken;
import org.jetbrains.kotlin.psi.addRemoveModifier.AddRemoveModifierPackage;
import org.jetbrains.kotlin.psi.findDocComment.FindDocCommentPackage;
import org.jetbrains.kotlin.psi.addRemoveModifier.AddRemoveModifierKt;
import org.jetbrains.kotlin.psi.findDocComment.FindDocCommentKt;
import java.util.Collections;
import java.util.List;
@@ -47,18 +47,18 @@ abstract class JetDeclarationImpl extends JetExpressionImpl implements JetDeclar
@Override
public void addModifier(@NotNull JetModifierKeywordToken modifier) {
AddRemoveModifierPackage.addModifier(this, modifier);
AddRemoveModifierKt.addModifier(this, modifier);
}
@Override
public void removeModifier(@NotNull JetModifierKeywordToken modifier) {
AddRemoveModifierPackage.removeModifier(this, modifier);
AddRemoveModifierKt.removeModifier(this, modifier);
}
@NotNull
@Override
public JetAnnotationEntry addAnnotationEntry(@NotNull JetAnnotationEntry annotationEntry) {
return AddRemoveModifierPackage.addAnnotationEntry(this, annotationEntry);
return AddRemoveModifierKt.addAnnotationEntry(this, annotationEntry);
}
@NotNull
@@ -80,6 +80,6 @@ abstract class JetDeclarationImpl extends JetExpressionImpl implements JetDeclar
@Nullable
@Override
public KDoc getDocComment() {
return FindDocCommentPackage.findDocComment(this);
return FindDocCommentKt.findDocComment(this);
}
}
@@ -24,7 +24,7 @@ import com.intellij.psi.stubs.StubElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.kdoc.psi.api.KDoc;
import org.jetbrains.kotlin.psi.findDocComment.FindDocCommentPackage;
import org.jetbrains.kotlin.psi.findDocComment.FindDocCommentKt;
import org.jetbrains.kotlin.psi.stubs.KotlinClassOrObjectStub;
abstract class JetDeclarationStub<T extends StubElement<?>> extends JetModifierListOwnerStub<T> implements JetDeclaration {
@@ -51,7 +51,7 @@ abstract class JetDeclarationStub<T extends StubElement<?>> extends JetModifierL
@Nullable
@Override
public KDoc getDocComment() {
return FindDocCommentPackage.findDocComment(this);
return FindDocCommentKt.findDocComment(this);
}
@Override
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.psi;
import com.intellij.lang.ASTNode;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub;
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes;
@@ -46,6 +46,6 @@ public class JetFileAnnotationList extends JetElementImplStub<KotlinPlaceHolderS
@NotNull
public List<JetAnnotationEntry> getAnnotationEntries() {
return PsiUtilPackage.collectAnnotationEntriesFromStubOrPsi(this);
return JetPsiUtilKt.collectAnnotationEntriesFromStubOrPsi(this);
}
}
@@ -18,12 +18,9 @@ package org.jetbrains.kotlin.psi;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.JetNodeTypes;
import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersPackage;
import java.util.Collections;
import java.util.List;
@@ -45,7 +45,7 @@ public class JetImportsFactory {
return directive;
}
JetImportDirective createdDirective = JetPsiFactory(project).createImportDirective(importPath);
JetImportDirective createdDirective = JetPsiFactoryKt.JetPsiFactory(project).createImportDirective(importPath);
importsCache.put(importPath, createdDirective);
return createdDirective;
@@ -22,7 +22,7 @@ import com.intellij.psi.stubs.IStubElementType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.lexer.JetModifierKeywordToken;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
import org.jetbrains.kotlin.psi.stubs.KotlinModifierListStub;
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes;
@@ -50,7 +50,7 @@ public abstract class JetModifierList extends JetElementImplStub<KotlinModifierL
@NotNull
public List<JetAnnotationEntry> getAnnotationEntries() {
return PsiUtilPackage.collectAnnotationEntriesFromStubOrPsi(this);
return JetPsiUtilKt.collectAnnotationEntriesFromStubOrPsi(this);
}
public boolean hasModifier(@NotNull JetModifierKeywordToken tokenType) {
@@ -22,7 +22,7 @@ import com.intellij.psi.stubs.StubElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.lexer.JetModifierKeywordToken;
import org.jetbrains.kotlin.psi.addRemoveModifier.AddRemoveModifierPackage;
import org.jetbrains.kotlin.psi.addRemoveModifier.AddRemoveModifierKt;
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes;
import java.util.Collections;
@@ -51,18 +51,18 @@ public class JetModifierListOwnerStub<T extends StubElement<?>> extends JetEleme
@Override
public void addModifier(@NotNull JetModifierKeywordToken modifier) {
AddRemoveModifierPackage.addModifier(this, modifier);
AddRemoveModifierKt.addModifier(this, modifier);
}
@Override
public void removeModifier(@NotNull JetModifierKeywordToken modifier) {
AddRemoveModifierPackage.removeModifier(this, modifier);
AddRemoveModifierKt.removeModifier(this, modifier);
}
@NotNull
@Override
public JetAnnotationEntry addAnnotationEntry(@NotNull JetAnnotationEntry annotationEntry) {
return AddRemoveModifierPackage.addAnnotationEntry(this, annotationEntry);
return AddRemoveModifierKt.addAnnotationEntry(this, annotationEntry);
}
@Override
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.JetNodeTypes;
import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersPackage;
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersKt;
import java.util.Collections;
import java.util.List;
@@ -41,13 +41,13 @@ public class JetMultiDeclarationEntry extends JetNamedDeclarationNotStubbed impl
@Override
public JetTypeReference getTypeReference() {
return TypeRefHelpersPackage.getTypeReference(this);
return TypeRefHelpersKt.getTypeReference(this);
}
@Override
@Nullable
public JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef) {
return TypeRefHelpersPackage.setTypeReference(this, getNameIdentifier(), typeRef);
return TypeRefHelpersKt.setTypeReference(this, getNameIdentifier(), typeRef);
}
@Nullable
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.lexer.JetTokens;
import static org.jetbrains.kotlin.psi.PsiPackage.JetPsiFactory;
import static org.jetbrains.kotlin.psi.JetPsiFactoryKt.JetPsiFactory;
// TODO: Remove when all named declarations get stubs
@Deprecated
@@ -28,7 +28,7 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.psi.stubs.KotlinFunctionStub;
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes;
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersPackage;
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersKt;
import java.util.Collections;
import java.util.List;
@@ -184,13 +184,13 @@ public class JetNamedFunction extends JetTypeParameterListOwnerStub<KotlinFuncti
}
return typeReferences.get(returnTypeIndex);
}
return TypeRefHelpersPackage.getTypeReference(this);
return TypeRefHelpersKt.getTypeReference(this);
}
@Override
@Nullable
public JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef) {
return TypeRefHelpersPackage.setTypeReference(this, getValueParameterList(), typeRef);
return TypeRefHelpersKt.setTypeReference(this, getValueParameterList(), typeRef);
}
@Nullable
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.lexer.JetTokens;
import static org.jetbrains.kotlin.psi.PsiPackage.JetPsiFactory;
import static org.jetbrains.kotlin.psi.JetPsiFactoryKt.JetPsiFactory;
public class JetObjectDeclarationName extends JetExpressionImpl {
public JetObjectDeclarationName(@NotNull ASTNode node) {
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.name.SpecialNames;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub;
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes;
@@ -80,7 +80,7 @@ public class JetPackageDirective extends JetModifierListOwnerStub<KotlinPlaceHol
JetExpression nameExpression = getPackageNameExpression();
if (nameExpression == null) return null;
return (JetSimpleNameExpression)PsiUtilPackage.getQualifiedElementSelector(nameExpression);
return (JetSimpleNameExpression) JetPsiUtilKt.getQualifiedElementSelector(nameExpression);
}
@Nullable
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.psi.stubs.KotlinParameterStub;
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes;
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersPackage;
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersKt;
import java.util.Collections;
import java.util.List;
@@ -55,7 +55,7 @@ public class JetParameter extends JetNamedDeclarationStub<KotlinParameterStub> i
@Override
@Nullable
public JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef) {
return TypeRefHelpersPackage.setTypeReference(this, getNameIdentifier(), typeRef);
return TypeRefHelpersKt.setTypeReference(this, getNameIdentifier(), typeRef);
}
@Nullable
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.JetNodeTypes;
import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.psi.stubs.KotlinPropertyStub;
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes;
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersPackage;
import org.jetbrains.kotlin.psi.typeRefHelpers.TypeRefHelpersKt;
import java.util.Collections;
import java.util.List;
@@ -142,13 +142,13 @@ public class JetProperty extends JetTypeParameterListOwnerStub<KotlinPropertyStu
return typeReferences.get(returnTypeRefPositionInPsi);
}
}
return TypeRefHelpersPackage.getTypeReference(this);
return TypeRefHelpersKt.getTypeReference(this);
}
@Override
@Nullable
public JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef) {
return TypeRefHelpersPackage.setTypeReference(this, getNameIdentifier(), typeRef);
return TypeRefHelpersKt.setTypeReference(this, getNameIdentifier(), typeRef);
}
@Nullable
@@ -41,9 +41,9 @@ import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.name.SpecialNames;
import org.jetbrains.kotlin.parsing.JetExpressionParsing;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.kotlin.resolve.ResolvePackage;
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
import org.jetbrains.kotlin.resolve.StatementFilter;
import org.jetbrains.kotlin.resolve.StatementFilterKt;
import org.jetbrains.kotlin.types.expressions.OperatorConventions;
import java.util.Collection;
@@ -263,12 +263,12 @@ public class JetPsiUtil {
@Nullable
public static JetSimpleNameExpression getLastReference(@NotNull JetExpression importedReference) {
JetElement selector = PsiUtilPackage.getQualifiedElementSelector(importedReference);
JetElement selector = JetPsiUtilKt.getQualifiedElementSelector(importedReference);
return selector instanceof JetSimpleNameExpression ? (JetSimpleNameExpression) selector : null;
}
public static boolean isSelectorInQualified(@NotNull JetSimpleNameExpression nameExpression) {
JetElement qualifiedElement = PsiUtilPackage.getQualifiedElement(nameExpression);
JetElement qualifiedElement = JetPsiUtilKt.getQualifiedElement(nameExpression);
return qualifiedElement instanceof JetQualifiedExpression
|| ((qualifiedElement instanceof JetUserType) && ((JetUserType) qualifiedElement).getQualifier() != null);
}
@@ -502,7 +502,7 @@ public class JetPsiUtil {
if (parentExpression instanceof JetCallExpression && currentInner == ((JetCallExpression) parentExpression).getCalleeExpression()) {
if (innerExpression instanceof JetSimpleNameExpression) return false;
if (PsiUtilPackage.getQualifiedExpressionForSelector(parentExpression) != null) return true;
if (JetPsiUtilKt.getQualifiedExpressionForSelector(parentExpression) != null) return true;
return !(innerExpression instanceof JetThisExpression
|| innerExpression instanceof JetArrayAccessExpression
|| innerExpression instanceof JetConstantExpression
@@ -845,7 +845,7 @@ public class JetPsiUtil {
// This case is a temporary hack for 'if' branches.
// The right way to implement this logic is to interpret 'if' branches as function literals with explicitly-typed signatures
// (no arguments and no receiver) and therefore analyze them straight away (not in the 'complete' phase).
JetExpression lastStatementInABlock = ResolvePackage.getLastStatementInABlock(statementFilter, blockExpression);
JetExpression lastStatementInABlock = StatementFilterKt.getLastStatementInABlock(statementFilter, blockExpression);
if (lastStatementInABlock != null) {
return getLastElementDeparenthesized(lastStatementInABlock, statementFilter);
}
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.psi.JetClass;
import org.jetbrains.kotlin.psi.JetEnumEntry;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
import org.jetbrains.kotlin.psi.stubs.KotlinClassStub;
import org.jetbrains.kotlin.psi.stubs.impl.KotlinClassStubImpl;
import org.jetbrains.kotlin.psi.stubs.impl.Utils;
@@ -57,10 +57,10 @@ public class JetClassElementType extends JetStubElementType<KotlinClassStub, Jet
public KotlinClassStub createStub(@NotNull JetClass psi, StubElement parentStub) {
FqName fqName = ResolveSessionUtils.safeFqNameForLazyResolve(psi);
boolean isEnumEntry = psi instanceof JetEnumEntry;
List<String> superNames = PsiUtilPackage.getSuperNames(psi);
List<String> superNames = JetPsiUtilKt.getSuperNames(psi);
return new KotlinClassStubImpl(
getStubType(isEnumEntry), parentStub, StringRef.fromString(fqName != null ? fqName.asString() : null),
StringRef.fromString(psi.getName()), Utils.INSTANCE$.wrapStrings(superNames), psi.isInterface(), isEnumEntry,
StringRef.fromString(psi.getName()), Utils.INSTANCE.wrapStrings(superNames), psi.isInterface(), isEnumEntry,
psi.isLocal(), psi.isTopLevel());
}
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.psi.JetObjectDeclaration;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
import org.jetbrains.kotlin.psi.stubs.KotlinObjectStub;
import org.jetbrains.kotlin.psi.stubs.impl.KotlinObjectStubImpl;
import org.jetbrains.kotlin.psi.stubs.impl.Utils;
@@ -43,8 +43,8 @@ public class JetObjectElementType extends JetStubElementType<KotlinObjectStub, J
public KotlinObjectStub createStub(@NotNull JetObjectDeclaration psi, StubElement parentStub) {
String name = psi.getName();
FqName fqName = ResolveSessionUtils.safeFqNameForLazyResolve(psi);
List<String> superNames = PsiUtilPackage.getSuperNames(psi);
return new KotlinObjectStubImpl(parentStub, StringRef.fromString(name), fqName, Utils.INSTANCE$.wrapStrings(superNames),
List<String> superNames = JetPsiUtilKt.getSuperNames(psi);
return new KotlinObjectStubImpl(parentStub, StringRef.fromString(name), fqName, Utils.INSTANCE.wrapStrings(superNames),
psi.isTopLevel(), psi.isCompanion(), psi.isLocal(), psi.isObjectLiteral());
}
@@ -25,7 +25,6 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.psi.JetProperty;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.kotlin.psi.stubs.KotlinPropertyStub;
import org.jetbrains.kotlin.psi.stubs.impl.KotlinPropertyStubImpl;
import org.jetbrains.kotlin.resolve.lazy.ResolveSessionUtils;
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticSink;
import org.jetbrains.kotlin.diagnostics.DiagnosticUtils;
import org.jetbrains.kotlin.psi.JetElement;
import org.jetbrains.kotlin.psi.JetTreeVisitorVoid;
import org.jetbrains.kotlin.psi.debugText.DebugTextPackage;
import org.jetbrains.kotlin.psi.debugText.DebugTextUtilKt;
import java.util.ArrayList;
import java.util.List;
@@ -70,7 +70,7 @@ public class AnalyzingUtils {
StringBuilder debugInfo = new StringBuilder(debugName);
if (resolutionSubjectForMessage instanceof JetElement) {
JetElement element = (JetElement) resolutionSubjectForMessage;
debugInfo.append(" ").append(DebugTextPackage.getDebugText(element));
debugInfo.append(" ").append(DebugTextUtilKt.getDebugText(element));
debugInfo.append(" in ").append(element.getContainingFile().getName());
}
else if (resolutionSubjectForMessage != null) {
@@ -25,8 +25,7 @@ import org.jetbrains.kotlin.diagnostics.Errors;
import org.jetbrains.kotlin.lexer.JetModifierKeywordToken;
import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.annotations.*;
import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage;
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
import org.jetbrains.kotlin.resolve.calls.CallResolver;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument;
import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults;
@@ -68,7 +67,7 @@ public class AnnotationResolver {
this.constantExpressionEvaluator = constantExpressionEvaluator;
this.storageManager = storageManager;
modifiersAnnotations = AnnotationsPackage.buildMigrationAnnotationDescriptors(kotlinBuiltIns);
modifiersAnnotations = AnnotationUtilKt.buildMigrationAnnotationDescriptors(kotlinBuiltIns);
}
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.diagnostics.Diagnostic;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
@@ -34,14 +34,13 @@ import org.jetbrains.kotlin.resolve.diagnostics.MutableDiagnosticsWithSuppressio
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.TypeUtils;
import org.jetbrains.kotlin.types.expressions.JetTypeInfo;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
import org.jetbrains.kotlin.util.slicedMap.MutableSlicedMap;
import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice;
import org.jetbrains.kotlin.util.slicedMap.WritableSlice;
import java.util.Collection;
import static org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.DECLARATION;
import static org.jetbrains.kotlin.diagnostics.Errors.AMBIGUOUS_LABEL;
import static org.jetbrains.kotlin.resolve.BindingContext.*;
@@ -161,7 +160,7 @@ public class BindingContextUtils {
if (!context.get(BindingContext.PROCESSED, expression)) return null;
// NB: should never return null if expression is already processed
JetTypeInfo result = context.get(BindingContext.EXPRESSION_TYPE_INFO, expression);
return result != null ? result : TypeInfoFactoryPackage.noTypeInfo(DataFlowInfo.EMPTY);
return result != null ? result : TypeInfoFactoryKt.noTypeInfo(DataFlowInfo.EMPTY);
}
public static boolean isExpressionWithValidReference(
@@ -169,7 +168,7 @@ public class BindingContextUtils {
@NotNull BindingContext context
) {
if (expression instanceof JetCallExpression) {
ResolvedCall<?> resolvedCall = CallUtilPackage.getResolvedCall(expression, context);
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(expression, context);
return resolvedCall instanceof VariableAsFunctionResolvedCall;
}
return expression instanceof JetReferenceExpression;
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics;
import org.jetbrains.kotlin.resolve.diagnostics.MutableDiagnosticsWithSuppression;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.expressions.JetTypeInfo;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
import org.jetbrains.kotlin.util.slicedMap.*;
import java.util.Collection;
@@ -139,7 +139,7 @@ public class BindingTraceContext implements BindingTrace {
@Override
public void recordType(@NotNull JetExpression expression, @Nullable JetType type) {
JetTypeInfo typeInfo = get(BindingContext.EXPRESSION_TYPE_INFO, expression);
typeInfo = typeInfo != null ? typeInfo.replaceType(type) : TypeInfoFactoryPackage.createTypeInfo(type);
typeInfo = typeInfo != null ? typeInfo.replaceType(type) : TypeInfoFactoryKt.createTypeInfo(type);
record(BindingContext.EXPRESSION_TYPE_INFO, expression, typeInfo);
}
}
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor;
import org.jetbrains.kotlin.diagnostics.Errors;
import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt;
import org.jetbrains.kotlin.resolve.calls.CallResolver;
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
@@ -46,7 +46,7 @@ import org.jetbrains.kotlin.types.*;
import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext;
import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices;
import org.jetbrains.kotlin.types.expressions.ValueParameterResolver;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
import org.jetbrains.kotlin.util.Box;
import org.jetbrains.kotlin.util.ReenteringLazyValueComputationException;
import org.jetbrains.kotlin.util.slicedMap.WritableSlice;
@@ -330,7 +330,7 @@ public class BodyResolver {
// Recording type info for callee to use later in JetObjectLiteralExpression
trace.record(PROCESSED, call.getCalleeExpression(), true);
trace.record(EXPRESSION_TYPE_INFO, call.getCalleeExpression(),
TypeInfoFactoryPackage.noTypeInfo(results.getResultingCall().getDataFlowInfoForArguments().getResultInfo()));
TypeInfoFactoryKt.noTypeInfo(results.getResultingCall().getDataFlowInfoForArguments().getResultInfo()));
}
else {
recordSupertype(typeReference, trace.getBindingContext().get(BindingContext.TYPE, typeReference));
@@ -450,7 +450,7 @@ public class BodyResolver {
addSupertype = false;
}
else if (supertypeOwner.getKind() == ClassKind.INTERFACE &&
!classAppeared && !TypesPackage.isDynamic(supertype) /* avoid duplicate diagnostics */) {
!classAppeared && !DynamicTypesKt.isDynamic(supertype) /* avoid duplicate diagnostics */) {
trace.report(INTERFACE_WITH_SUPERCLASS.on(typeReference));
addSupertype = false;
}
@@ -744,7 +744,7 @@ public class BodyResolver {
JetNamedFunction declaration = entry.getKey();
LexicalScope scope = c.getDeclaringScope(declaration);
assert scope != null : "Scope is null: " + PsiUtilPackage.getElementTextWithContext(declaration);
assert scope != null : "Scope is null: " + PsiUtilsKt.getElementTextWithContext(declaration);
if (!c.getTopDownAnalysisMode().isLocalDeclarations() && !(bodyResolveCache instanceof BodyResolveCache.ThrowException) &&
expressionTypingServices.getStatementFilter() != StatementFilter.NONE) {
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.diagnostics.rendering.Renderers;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystem;
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemCompleter;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
@@ -48,9 +49,8 @@ import java.util.Collections;
import java.util.List;
import static org.jetbrains.kotlin.diagnostics.Errors.*;
import static org.jetbrains.kotlin.psi.PsiPackage.JetPsiFactory;
import static org.jetbrains.kotlin.psi.JetPsiFactoryKt.JetPsiFactory;
import static org.jetbrains.kotlin.resolve.BindingContext.*;
import static org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage.getCalleeExpressionIfAny;
import static org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.ConstraintPositionKind.FROM_COMPLETER;
import static org.jetbrains.kotlin.types.TypeUtils.NO_EXPECTED_TYPE;
import static org.jetbrains.kotlin.types.TypeUtils.noExpectedType;
@@ -313,7 +313,7 @@ public class DelegatedPropertyResolver {
@NotNull DataFlowInfo dataFlowInfo
) {
TemporaryBindingTrace traceToResolveDelegatedProperty = TemporaryBindingTrace.create(trace, "Trace to resolve delegated property");
JetExpression calleeExpression = getCalleeExpressionIfAny(delegateExpression);
JetExpression calleeExpression = CallUtilKt.getCalleeExpressionIfAny(delegateExpression);
ConstraintSystemCompleter completer = createConstraintSystemCompleter(
jetProperty, propertyDescriptor, delegateExpression, accessorScope, trace);
if (calleeExpression != null) {
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics;
import org.jetbrains.kotlin.resolve.diagnostics.MutableDiagnosticsWithSuppression;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.expressions.JetTypeInfo;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
import org.jetbrains.kotlin.util.slicedMap.*;
import java.util.Collection;
@@ -148,7 +148,7 @@ public class DelegatingBindingTrace implements BindingTrace {
public void recordType(@NotNull JetExpression expression, @Nullable JetType type) {
JetTypeInfo typeInfo = get(BindingContext.EXPRESSION_TYPE_INFO, expression);
if (typeInfo == null) {
typeInfo = TypeInfoFactoryPackage.createTypeInfo(type);
typeInfo = TypeInfoFactoryKt.createTypeInfo(type);
}
else {
typeInfo = typeInfo.replaceType(type);
@@ -38,17 +38,19 @@ import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant;
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator;
import org.jetbrains.kotlin.resolve.dataClassUtils.DataClassUtilsPackage;
import org.jetbrains.kotlin.resolve.dataClassUtils.DataClassUtilsKt;
import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil;
import org.jetbrains.kotlin.resolve.scopes.JetScopeUtils;
import org.jetbrains.kotlin.resolve.scopes.LexicalScope;
import org.jetbrains.kotlin.resolve.scopes.LexicalWritableScope;
import org.jetbrains.kotlin.resolve.scopes.WritableScope;
import org.jetbrains.kotlin.resolve.scopes.utils.ScopeUtilsKt;
import org.jetbrains.kotlin.resolve.source.KotlinSourceElementKt;
import org.jetbrains.kotlin.storage.StorageManager;
import org.jetbrains.kotlin.types.*;
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
@@ -64,8 +66,6 @@ import static org.jetbrains.kotlin.resolve.BindingContext.*;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
import static org.jetbrains.kotlin.resolve.ModifiersChecker.resolveModalityFromModifiers;
import static org.jetbrains.kotlin.resolve.ModifiersChecker.resolveVisibilityFromModifiers;
import static org.jetbrains.kotlin.resolve.scopes.utils.UtilsPackage.asJetScope;
import static org.jetbrains.kotlin.resolve.source.SourcePackage.toSourceElement;
public class DescriptorResolver {
public static final Name COPY_METHOD_NAME = Name.identifier("copy");
@@ -175,7 +175,7 @@ public class DescriptorResolver {
JetTypeReference typeReference = delegationSpecifier.getTypeReference();
if (typeReference != null) {
JetType supertype = resolver.resolveType(extensibleScope, typeReference, trace, checkBounds);
if (TypesPackage.isDynamic(supertype)) {
if (DynamicTypesKt.isDynamic(supertype)) {
trace.report(DYNAMIC_SUPERTYPE.on(typeReference));
}
else {
@@ -224,7 +224,7 @@ public class DescriptorResolver {
@NotNull ClassDescriptor classDescriptor,
@NotNull BindingTrace trace
) {
Name functionName = DataClassUtilsPackage.createComponentName(parameterIndex);
Name functionName = DataClassUtilsKt.createComponentName(parameterIndex);
JetType returnType = property.getType();
SimpleFunctionDescriptorImpl functionDescriptor = SimpleFunctionDescriptorImpl.create(
@@ -366,7 +366,7 @@ public class DescriptorResolver {
variableType,
valueParameter.hasDefaultValue(),
varargElementType,
toSourceElement(valueParameter)
KotlinSourceElementKt.toSourceElement(valueParameter)
);
trace.record(BindingContext.VALUE_PARAMETER, valueParameter, valueParameterDescriptor);
@@ -418,7 +418,7 @@ public class DescriptorResolver {
typeParameter.getVariance(),
JetPsiUtil.safeName(typeParameter.getName()),
index,
toSourceElement(typeParameter)
KotlinSourceElementKt.toSourceElement(typeParameter)
);
trace.record(BindingContext.TYPE_PARAMETER, typeParameter, typeParameterDescriptor);
extensibleScope.addClassifierDescriptor(typeParameterDescriptor);
@@ -432,7 +432,7 @@ public class DescriptorResolver {
@NotNull BindingTrace trace
) {
ConstructorDescriptorImpl constructorDescriptor =
DescriptorFactory.createPrimaryConstructorForObject(classDescriptor, toSourceElement(object));
DescriptorFactory.createPrimaryConstructorForObject(classDescriptor, KotlinSourceElementKt.toSourceElement(object));
if (object != null) {
JetPrimaryConstructor primaryConstructor = object.getPrimaryConstructor();
trace.record(CONSTRUCTOR, primaryConstructor != null ? primaryConstructor : object, constructorDescriptor);
@@ -549,7 +549,7 @@ public class DescriptorResolver {
Name name = nameExpression.getReferencedNameAsName();
ClassifierDescriptor classifier = asJetScope(scope).getClassifier(name, NoLookupLocation.UNSORTED);
ClassifierDescriptor classifier = ScopeUtilsKt.asJetScope(scope).getClassifier(name, NoLookupLocation.UNSORTED);
if (classifier instanceof TypeParameterDescriptor && classifier.getContainingDeclaration() == descriptor) continue;
if (classifier != null) {
@@ -580,7 +580,7 @@ public class DescriptorResolver {
}
trace.report(FINAL_UPPER_BOUND.on(upperBound, upperBoundType));
}
if (TypesPackage.isDynamic(upperBoundType)) {
if (DynamicTypesKt.isDynamic(upperBoundType)) {
trace.report(DYNAMIC_UPPER_BOUND.on(upperBound));
}
}
@@ -623,7 +623,7 @@ public class DescriptorResolver {
JetPsiUtil.safeName(parameter.getName()),
type,
false,
toSourceElement(parameter)
KotlinSourceElementKt.toSourceElement(parameter)
);
trace.record(BindingContext.VALUE_PARAMETER, parameter, variableDescriptor);
// Type annotations also should be resolved
@@ -651,7 +651,7 @@ public class DescriptorResolver {
variable.isVar(),
JetPsiUtil.safeName(variable.getName()),
CallableMemberDescriptor.Kind.DECLARATION,
toSourceElement(variable),
KotlinSourceElementKt.toSourceElement(variable),
/* lateInit = */ false,
/* isConst = */ false
);
@@ -704,7 +704,7 @@ public class DescriptorResolver {
JetPsiUtil.safeName(variable.getName()),
type,
variable.isVar(),
toSourceElement(variable)
KotlinSourceElementKt.toSourceElement(variable)
);
trace.record(BindingContext.VARIABLE, variable, variableDescriptor);
return variableDescriptor;
@@ -750,7 +750,7 @@ public class DescriptorResolver {
isVar,
JetPsiUtil.safeName(property.getName()),
CallableMemberDescriptor.Kind.DECLARATION,
toSourceElement(property),
KotlinSourceElementKt.toSourceElement(property),
modifierList != null && modifierList.hasModifier(JetTokens.LATEINIT_KEYWORD),
modifierList != null && modifierList.hasModifier(JetTokens.CONST_KEYWORD)
);
@@ -998,7 +998,8 @@ public class DescriptorResolver {
resolveModalityFromModifiers(setter, propertyDescriptor.getModality()),
resolveVisibilityFromModifiers(setter, propertyDescriptor.getVisibility()),
setter.hasBody(), false,
CallableMemberDescriptor.Kind.DECLARATION, null, toSourceElement(setter));
CallableMemberDescriptor.Kind.DECLARATION, null, KotlinSourceElementKt
.toSourceElement(setter));
if (parameter != null) {
// This check is redundant: the parser does not allow a default value, but we'll keep it just in case
@@ -1078,7 +1079,8 @@ public class DescriptorResolver {
resolveModalityFromModifiers(getter, propertyDescriptor.getModality()),
resolveVisibilityFromModifiers(getter, propertyDescriptor.getVisibility()),
getter.hasBody(), false,
CallableMemberDescriptor.Kind.DECLARATION, null, toSourceElement(getter));
CallableMemberDescriptor.Kind.DECLARATION, null, KotlinSourceElementKt
.toSourceElement(getter));
getterDescriptor.initialize(returnType);
trace.record(BindingContext.PROPERTY_ACCESSOR, getter, getterDescriptor);
}
@@ -1130,7 +1132,7 @@ public class DescriptorResolver {
isMutable,
name,
CallableMemberDescriptor.Kind.DECLARATION,
toSourceElement(parameter),
KotlinSourceElementKt.toSourceElement(parameter),
/* lateInit = */ false,
/* isConst = */ false
);
@@ -1167,12 +1169,12 @@ public class DescriptorResolver {
List<JetTypeReference> jetTypeArguments = typeElement.getTypeArgumentsAsTypes();
// A type reference from Kotlin code can yield a flexible type only if it's `ft<T1, T2>`, whose bounds should not be checked
if (TypesPackage.isFlexible(type) && !TypesPackage.isDynamic(type)) {
if (FlexibleTypesKt.isFlexible(type) && !DynamicTypesKt.isDynamic(type)) {
assert jetTypeArguments.size() == 2
: "Flexible type cannot be denoted in Kotlin otherwise than as ft<T1, T2>, but was: "
+ PsiUtilPackage.getElementTextWithContext(typeReference);
+ PsiUtilsKt.getElementTextWithContext(typeReference);
// it's really ft<Foo, Bar>
Flexibility flexibility = TypesPackage.flexibility(type);
Flexibility flexibility = FlexibleTypesKt.flexibility(type);
checkBounds(jetTypeArguments.get(0), flexibility.getLowerBound(), trace);
checkBounds(jetTypeArguments.get(1), flexibility.getUpperBound(), trace);
return;
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl;
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl;
import org.jetbrains.kotlin.resolve.scopes.*;
import org.jetbrains.kotlin.types.*;
import org.jetbrains.kotlin.types.typeUtil.TypeUtilPackage;
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
import java.util.ArrayList;
import java.util.Collections;
@@ -57,7 +57,7 @@ public class FunctionDescriptorUtil {
) {
if (functionDescriptor.getTypeParameters().isEmpty()) return TypeSubstitution.getEMPTY();
return new IndexedParametersSubstitution(functionDescriptor.getTypeParameters(), TypeUtilPackage.defaultProjections(typeArguments));
return new IndexedParametersSubstitution(functionDescriptor.getTypeParameters(), TypeUtilsKt.defaultProjections(typeArguments));
}
@NotNull
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.descriptors.ConstructorDescriptor;
import org.jetbrains.kotlin.descriptors.PropertyDescriptor;
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.TypesPackage;
import org.jetbrains.kotlin.types.TypeCapabilitiesKt;
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
import java.util.List;
@@ -72,7 +72,7 @@ public class OverloadUtil {
JetType superValueParameterType = OverridingUtil.getUpperBound(superValueParameters.get(i));
JetType subValueParameterType = OverridingUtil.getUpperBound(subValueParameters.get(i));
if (!JetTypeChecker.DEFAULT.equalTypes(superValueParameterType, subValueParameterType)
|| TypesPackage.oneMoreSpecificThanAnother(subValueParameterType, superValueParameterType)) {
|| TypeCapabilitiesKt.oneMoreSpecificThanAnother(subValueParameterType, superValueParameterType)) {
return OverridingUtil.OverrideCompatibilityInfo
.valueParameterTypeMismatch(superValueParameterType, subValueParameterType, INCOMPATIBLE);
}
@@ -38,8 +38,8 @@ import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilPackage;
import org.jetbrains.kotlin.resolve.dataClassUtils.DataClassUtilsPackage;
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt;
import org.jetbrains.kotlin.resolve.dataClassUtils.DataClassUtilsKt;
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import org.jetbrains.kotlin.types.*;
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
@@ -423,7 +423,7 @@ public class OverrideResolver {
@NotNull List<CallableMemberDescriptor> concreteOverridden
) {
for (CallableMemberDescriptor overridden : allOverriddenDeclarations) {
if (!CallResolverUtilPackage.isOrOverridesSynthesized(overridden)) {
if (!CallResolverUtilKt.isOrOverridesSynthesized(overridden)) {
if (overridden.getModality() == Modality.ABSTRACT) {
abstractOverridden.add(overridden);
}
@@ -566,7 +566,7 @@ public class OverrideResolver {
private void checkOverrideForMember(@NotNull final CallableMemberDescriptor declared) {
if (declared.getKind() == CallableMemberDescriptor.Kind.SYNTHESIZED) {
if (DataClassUtilsPackage.isComponentLike(declared.getName())) {
if (DataClassUtilsKt.isComponentLike(declared.getName())) {
checkOverrideForComponentFunction(declared);
}
return;
@@ -28,12 +28,13 @@ import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.BindingTrace;
import org.jetbrains.kotlin.resolve.TemporaryBindingTrace;
import org.jetbrains.kotlin.resolve.TypeResolver;
import org.jetbrains.kotlin.resolve.callableReferences.CallableReferencesPackage;
import org.jetbrains.kotlin.resolve.callableReferences.CallableReferencesResolutionUtilsKt;
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.ResolveArgumentsMode;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.context.CallResolutionContext;
import org.jetbrains.kotlin.resolve.calls.context.CheckArgumentTypesMode;
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext;
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemImplKt;
import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments;
import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
@@ -51,7 +52,7 @@ import org.jetbrains.kotlin.types.TypeUtils;
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices;
import org.jetbrains.kotlin.types.expressions.JetTypeInfo;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
import java.util.Collections;
import java.util.List;
@@ -62,7 +63,6 @@ import static org.jetbrains.kotlin.resolve.calls.callResolverUtil.ResolveArgumen
import static org.jetbrains.kotlin.resolve.calls.callResolverUtil.ResolveArgumentsMode.SHAPE_FUNCTION_ARGUMENTS;
import static org.jetbrains.kotlin.resolve.calls.context.ContextDependency.DEPENDENT;
import static org.jetbrains.kotlin.resolve.calls.context.ContextDependency.INDEPENDENT;
import static org.jetbrains.kotlin.resolve.calls.inference.InferencePackage.createTypeForFunctionPlaceholder;
import static org.jetbrains.kotlin.types.TypeUtils.DONT_CARE;
import static org.jetbrains.kotlin.types.TypeUtils.NO_EXPECTED_TYPE;
@@ -98,7 +98,7 @@ public class ArgumentTypeResolver {
@NotNull JetType expectedType
) {
if (FunctionPlaceholdersKt.isFunctionPlaceholder(actualType)) {
JetType functionType = createTypeForFunctionPlaceholder(actualType, expectedType);
JetType functionType = ConstraintSystemImplKt.createTypeForFunctionPlaceholder(actualType, expectedType);
return JetTypeChecker.DEFAULT.isSubtypeOf(functionType, expectedType);
}
return JetTypeChecker.DEFAULT.isSubtypeOf(actualType, expectedType);
@@ -200,7 +200,7 @@ public class ArgumentTypeResolver {
@NotNull ResolveArgumentsMode resolveArgumentsMode
) {
if (expression == null) {
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
JetFunction functionLiteralArgument = getFunctionLiteralArgumentIfAny(expression, context);
@@ -232,7 +232,7 @@ public class ArgumentTypeResolver {
) {
if (resolveArgumentsMode == SHAPE_FUNCTION_ARGUMENTS) {
JetType type = getShapeTypeOfCallableReference(callableReferenceExpression, context, true);
return TypeInfoFactoryPackage.createTypeInfo(type);
return TypeInfoFactoryKt.createTypeInfo(type);
}
return expressionTypingServices.getTypeInfo(expression, context.replaceContextDependency(INDEPENDENT));
}
@@ -244,12 +244,12 @@ public class ArgumentTypeResolver {
boolean expectedTypeIsUnknown
) {
JetType receiverType =
CallableReferencesPackage.resolveCallableReferenceReceiverType(callableReferenceExpression, context, typeResolver);
CallableReferencesResolutionUtilsKt.resolveCallableReferenceReceiverType(callableReferenceExpression, context, typeResolver);
OverloadResolutionResults<CallableDescriptor> overloadResolutionResults =
CallableReferencesPackage.resolvePossiblyAmbiguousCallableReference(
CallableReferencesResolutionUtilsKt.resolvePossiblyAmbiguousCallableReference(
callableReferenceExpression, receiverType, context, ResolveArgumentsMode.SHAPE_FUNCTION_ARGUMENTS,
callResolver);
return CallableReferencesPackage.getResolvedCallableReferenceShapeType(
return CallableReferencesResolutionUtilsKt.getResolvedCallableReferenceShapeType(
callableReferenceExpression, overloadResolutionResults, context, expectedTypeIsUnknown,
reflectionTypes, builtIns, functionPlaceholders);
}
@@ -263,7 +263,7 @@ public class ArgumentTypeResolver {
) {
if (resolveArgumentsMode == SHAPE_FUNCTION_ARGUMENTS) {
JetType type = getShapeTypeOfFunctionLiteral(functionLiteral, context.scope, context.trace, true);
return TypeInfoFactoryPackage.createTypeInfo(type, context);
return TypeInfoFactoryKt.createTypeInfo(type, context);
}
return expressionTypingServices.getTypeInfo(expression, context.replaceContextDependency(INDEPENDENT));
}
@@ -329,7 +329,7 @@ public class ArgumentTypeResolver {
// For an unsafe call, we should not do it,
// otherwise not-null will propagate to successive statements
// Sample: x?.foo(x.bar()) // Inside foo call, x is not-nullable
if (CallUtilPackage.isSafeCall(call)) {
if (CallUtilKt.isSafeCall(call)) {
initialDataFlowInfo = initialDataFlowInfo.disequate(receiverDataFlowValue, DataFlowValue.nullValue(builtIns));
}
}
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.BindingTrace;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext;
import org.jetbrains.kotlin.resolve.calls.context.CheckArgumentTypesMode;
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext;
@@ -49,7 +49,7 @@ import org.jetbrains.kotlin.types.expressions.DataFlowAnalyzer;
import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext;
import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices;
import org.jetbrains.kotlin.types.expressions.JetTypeInfo;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
import javax.inject.Inject;
import java.util.Collections;
@@ -57,8 +57,6 @@ import java.util.List;
import static org.jetbrains.kotlin.diagnostics.Errors.*;
import static org.jetbrains.kotlin.resolve.calls.context.ContextDependency.INDEPENDENT;
import static org.jetbrains.kotlin.resolve.scopes.receivers.ReceiversPackage.createQualifier;
import static org.jetbrains.kotlin.resolve.scopes.receivers.ReceiversPackage.resolveAsStandaloneExpression;
import static org.jetbrains.kotlin.types.TypeUtils.NO_EXPECTED_TYPE;
public class CallExpressionResolver {
@@ -129,11 +127,11 @@ public class CallExpressionResolver {
}
}
QualifierReceiver qualifier = createQualifier(nameExpression, receiver, context);
QualifierReceiver qualifier = QualifierKt.createQualifier(nameExpression, receiver, context);
if (qualifier != null) {
result[0] = true;
if (!isLHSOfDot) {
resolveAsStandaloneExpression(qualifier, context, symbolUsageValidator);
QualifierKt.resolveAsStandaloneExpression(qualifier, context, symbolUsageValidator);
}
return null;
}
@@ -159,7 +157,7 @@ public class CallExpressionResolver {
if (result[0]) {
temporaryForVariable.commit();
return TypeInfoFactoryPackage.createTypeInfo(type, context);
return TypeInfoFactoryKt.createTypeInfo(type, context);
}
Call call = CallMaker.makeCall(nameExpression, receiver, callOperationNode, nameExpression, Collections.<ValueArgument>emptyList());
@@ -174,11 +172,11 @@ public class CallExpressionResolver {
boolean hasValueParameters = functionDescriptor == null || functionDescriptor.getValueParameters().size() > 0;
context.trace.report(FUNCTION_CALL_EXPECTED.on(nameExpression, nameExpression, hasValueParameters));
type = functionDescriptor != null ? functionDescriptor.getReturnType() : null;
return TypeInfoFactoryPackage.createTypeInfo(type, context);
return TypeInfoFactoryKt.createTypeInfo(type, context);
}
temporaryForVariable.commit();
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
@NotNull
@@ -221,7 +219,7 @@ public class CallExpressionResolver {
context.trace.report(FUNCTION_CALL_EXPECTED.on(callExpression, callExpression, hasValueParameters));
}
if (functionDescriptor == null) {
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
if (functionDescriptor instanceof ConstructorDescriptor) {
DeclarationDescriptor containingDescriptor = functionDescriptor.getContainingDeclaration();
@@ -252,7 +250,7 @@ public class CallExpressionResolver {
break;
}
}
return TypeInfoFactoryPackage.createTypeInfo(type, resultFlowInfo, jumpOutPossible, jumpFlowInfo);
return TypeInfoFactoryKt.createTypeInfo(type, resultFlowInfo, jumpOutPossible, jumpFlowInfo);
}
JetExpression calleeExpression = callExpression.getCalleeExpression();
@@ -266,11 +264,11 @@ public class CallExpressionResolver {
temporaryForVariable.commit();
context.trace.report(FUNCTION_EXPECTED.on(calleeExpression, calleeExpression,
type != null ? type : ErrorUtils.createErrorType("")));
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
}
temporaryForFunction.commit();
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
private static boolean canInstantiateAnnotationClass(@NotNull JetCallExpression expression, @NotNull BindingTrace trace) {
@@ -306,7 +304,7 @@ public class CallExpressionResolver {
else if (selectorExpression != null) {
context.trace.report(ILLEGAL_SELECTOR.on(selectorExpression, selectorExpression.getText()));
}
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
/**
@@ -443,11 +441,11 @@ public class CallExpressionResolver {
) {
if (qualifierReceiver == null) return;
JetExpression calleeExpression =
JetPsiUtil.deparenthesize(CallUtilPackage.getCalleeExpressionIfAny(qualifiedExpression.getSelectorExpression()));
JetPsiUtil.deparenthesize(CallUtilKt.getCalleeExpressionIfAny(qualifiedExpression.getSelectorExpression()));
DeclarationDescriptor selectorDescriptor =
calleeExpression instanceof JetReferenceExpression
? context.trace.get(BindingContext.REFERENCE_TARGET, (JetReferenceExpression) calleeExpression) : null;
ReceiversPackage.resolveAsReceiverInQualifiedExpression(qualifierReceiver, context, symbolUsageValidator, selectorDescriptor);
QualifierKt.resolveAsReceiverInQualifiedExpression(qualifierReceiver, context, symbolUsageValidator, selectorDescriptor);
}
private static void checkNestedClassAccess(
@@ -31,8 +31,9 @@ import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.*;
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilPackage;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilsKt;
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker;
import org.jetbrains.kotlin.resolve.calls.context.*;
import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments;
@@ -45,7 +46,7 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
import org.jetbrains.kotlin.resolve.calls.tasks.*;
import org.jetbrains.kotlin.resolve.calls.tasks.collectors.CallableDescriptorCollectors;
import org.jetbrains.kotlin.resolve.calls.util.CallMaker;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil;
import org.jetbrains.kotlin.resolve.scopes.LexicalScope;
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
@@ -65,8 +66,6 @@ import java.util.Collections;
import java.util.List;
import static org.jetbrains.kotlin.diagnostics.Errors.*;
import static org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilPackage.recordDataFlowInfo;
import static org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilPackage.recordScope;
import static org.jetbrains.kotlin.resolve.calls.callResolverUtil.ResolveArgumentsMode.RESOLVE_FUNCTION_ARGUMENTS;
import static org.jetbrains.kotlin.resolve.calls.callResolverUtil.ResolveArgumentsMode.SHAPE_FUNCTION_ARGUMENTS;
import static org.jetbrains.kotlin.resolve.calls.context.CandidateResolveMode.EXIT_ON_FIRST_ERROR;
@@ -357,7 +356,7 @@ public class CallResolver {
ClassDescriptor classDescriptor = (ClassDescriptor) declarationDescriptor;
Collection<ConstructorDescriptor> constructors = classDescriptor.getConstructors();
if (constructors.isEmpty()) {
context.trace.report(NO_CONSTRUCTOR.on(CallUtilPackage.getValueArgumentListOrElement(context.call)));
context.trace.report(NO_CONSTRUCTOR.on(CallUtilKt.getValueArgumentListOrElement(context.call)));
return checkArgumentTypesAndFail(context);
}
Collection<ResolutionCandidate<CallableDescriptor>> candidates =
@@ -414,7 +413,7 @@ public class CallResolver {
}
ClassDescriptor delegateClassDescriptor = isThisCall ? currentClassDescriptor :
DescriptorUtilPackage.getSuperClassOrAny(currentClassDescriptor);
DescriptorUtilsKt.getSuperClassOrAny(currentClassDescriptor);
Collection<ConstructorDescriptor> constructors = delegateClassDescriptor.getConstructors();
if (!isThisCall && currentClassDescriptor.getUnsubstitutedPrimaryConstructor() != null) {
@@ -428,7 +427,7 @@ public class CallResolver {
}
if (constructors.isEmpty()) {
context.trace.report(NO_CONSTRUCTOR.on(CallUtilPackage.getValueArgumentListOrElement(context.call)));
context.trace.report(NO_CONSTRUCTOR.on(CallUtilKt.getValueArgumentListOrElement(context.call)));
return checkArgumentTypesAndFail(context);
}
@@ -489,8 +488,8 @@ public class CallResolver {
TemporaryBindingTrace traceToResolveCall = TemporaryBindingTrace.create(context.trace, "trace to resolve call", call);
BasicCallResolutionContext newContext = context.replaceBindingTrace(traceToResolveCall);
recordScope(newContext.trace, newContext.scope, newContext.call.getCalleeExpression());
recordDataFlowInfo(newContext, newContext.call.getCalleeExpression());
BindingContextUtilsKt.recordScope(newContext.trace, newContext.scope, newContext.call.getCalleeExpression());
BindingContextUtilsKt.recordDataFlowInfo(newContext, newContext.call.getCalleeExpression());
OverloadResolutionResultsImpl<F> results = doResolveCall(newContext, prioritizedTasks, callTransformer, tracing);
DelegatingBindingTrace deltasTraceForTypeInference = ((OverloadResolutionResultsImpl) results).getTrace();
@@ -515,7 +514,7 @@ public class CallResolver {
@NotNull OverloadResolutionResultsImpl<D> results,
@NotNull TracingStrategy tracing
) {
if (CallResolverUtilPackage.isInvokeCallOnVariable(context.call)) return;
if (CallResolverUtilKt.isInvokeCallOnVariable(context.call)) return;
if (!results.isSingleResult()) {
if (results.getResultCode() == INCOMPLETE_TYPE_INFERENCE) {
argumentTypeResolver.checkTypesWithNoCallee(context, RESOLVE_FUNCTION_ARGUMENTS);
@@ -535,7 +534,7 @@ public class CallResolver {
@NotNull TracingStrategy tracing
) {
Call call = context.call;
if (CallResolverUtilPackage.isInvokeCallOnVariable(call)) return;
if (CallResolverUtilKt.isInvokeCallOnVariable(call)) return;
DelegatingBindingTrace deltasTraceToCacheResolve = new DelegatingBindingTrace(
BindingContext.EMPTY, "delta trace for caching resolve of", context.call);
@@ -277,7 +277,7 @@ public class CallTransformer<D extends CallableDescriptor, F extends D> {
this.explicitExtensionReceiver = explicitExtensionReceiver;
this.calleeExpressionAsDispatchReceiver = calleeExpressionAsDispatchReceiver;
this.fakeInvokeExpression =
(JetSimpleNameExpression) JetPsiFactory(call.getCallElement())
(JetSimpleNameExpression) JetPsiFactoryKt.JetPsiFactory(call.getCallElement())
.createExpression(OperatorNameConventions.INVOKE.asString());
}
@@ -27,10 +27,10 @@ import org.jetbrains.kotlin.diagnostics.Diagnostic;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.OverrideResolver;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.model.*;
import org.jetbrains.kotlin.resolve.calls.tasks.TracingStrategy;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import java.util.List;
import java.util.Map;
@@ -233,7 +233,7 @@ public class ValueArgumentsToParametersMapper {
public void process() {
ProcessorState state = positionedOnly;
List<? extends ValueArgument> argumentsInParentheses = CallUtilPackage.getValueArgumentsInParentheses(call);
List<? extends ValueArgument> argumentsInParentheses = CallUtilKt.getValueArgumentsInParentheses(call);
for (int i = 0; i < argumentsInParentheses.size(); i++) {
ValueArgument valueArgument = argumentsInParentheses.get(i);
if (valueArgument.isNamed()) {
@@ -294,7 +294,7 @@ public class ValueArgumentsToParametersMapper {
List<ValueParameterDescriptor> valueParameters = candidateCall.getCandidateDescriptor().getValueParameters();
for (ValueParameterDescriptor valueParameter : valueParameters) {
if (!usedParameters.contains(valueParameter)) {
if (DescriptorUtilPackage.hasDefaultValue(valueParameter)) {
if (DescriptorUtilsKt.hasDefaultValue(valueParameter)) {
candidateCall.recordValueArgument(valueParameter, DefaultValueArgument.DEFAULT);
}
else if (valueParameter.getVarargElementType() != null) {
@@ -25,12 +25,13 @@ import org.jetbrains.kotlin.lexer.JetToken;
import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext;
import org.jetbrains.kotlin.resolve.calls.model.DefaultValueArgument;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument;
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
import org.jetbrains.kotlin.resolve.scopes.receivers.ExtensionReceiver;
@@ -43,7 +44,6 @@ import java.util.Set;
import static org.jetbrains.kotlin.diagnostics.Errors.NON_LOCAL_RETURN_NOT_ALLOWED;
import static org.jetbrains.kotlin.diagnostics.Errors.USAGE_IS_NOT_INLINABLE;
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.isEffectivelyPublicApi;
import static org.jetbrains.kotlin.resolve.inline.InlineUtil.allowsNonLocalReturns;
import static org.jetbrains.kotlin.resolve.inline.InlineUtil.checkNonLocalReturnUsage;
@@ -55,7 +55,7 @@ class InlineChecker implements CallChecker {
public InlineChecker(@NotNull SimpleFunctionDescriptor descriptor) {
assert InlineUtil.isInline(descriptor) : "This extension should be created only for inline functions: " + descriptor;
this.descriptor = descriptor;
this.isEffectivelyPublicApiFunction = isEffectivelyPublicApi(descriptor);
this.isEffectivelyPublicApiFunction = DescriptorUtilsKt.isEffectivelyPublicApi(descriptor);
for (ValueParameterDescriptor param : descriptor.getValueParameters()) {
if (isInlinableParameter(param)) {
@@ -186,7 +186,7 @@ class InlineChecker implements CallChecker {
) {
if (!(expression instanceof JetSimpleNameExpression || expression instanceof JetThisExpression)) return null;
ResolvedCall<?> thisCall = CallUtilPackage.getResolvedCall(expression, context.trace.getBindingContext());
ResolvedCall<?> thisCall = CallUtilKt.getResolvedCall(expression, context.trace.getBindingContext());
if (unwrapVariableAsFunction && thisCall instanceof VariableAsFunctionResolvedCall) {
return ((VariableAsFunctionResolvedCall) thisCall).getVariableCall().getResultingDescriptor();
}
@@ -236,7 +236,7 @@ class InlineChecker implements CallChecker {
}
private void checkVisibility(@NotNull CallableDescriptor declarationDescriptor, @NotNull JetElement expression, @NotNull BasicCallResolutionContext context){
boolean declarationDescriptorIsPublicApi = isEffectivelyPublicApi(declarationDescriptor) || isDefinedInInlineFunction(declarationDescriptor);
boolean declarationDescriptorIsPublicApi = DescriptorUtilsKt.isEffectivelyPublicApi(declarationDescriptor) || isDefinedInInlineFunction(declarationDescriptor);
if (isEffectivelyPublicApiFunction && !declarationDescriptorIsPublicApi && declarationDescriptor.getVisibility() != Visibilities.LOCAL) {
context.trace.report(Errors.INVISIBLE_MEMBER_FROM_INLINE.on(expression, declarationDescriptor, descriptor));
}
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.psi.JetExpression;
import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.typeUtil.TypeUtilPackage;
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
import java.util.Map;
@@ -49,7 +49,7 @@ public class ReifiedTypeParameterSubstitutionChecker implements CallChecker {
Errors.TYPE_PARAMETER_AS_REIFIED.on(getCallElement(context), parameter)
);
}
else if (TypeUtilPackage.cannotBeReified(argument)) {
else if (TypeUtilsKt.cannotBeReified(argument)) {
context.trace.report(Errors.REIFIED_TYPE_FORBIDDEN_SUBSTITUTION.on(getCallElement(context), argument));
}
}
@@ -27,8 +27,8 @@ import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
import org.jetbrains.kotlin.psi.Call;
import org.jetbrains.kotlin.psi.ValueArgument;
import org.jetbrains.kotlin.resolve.DelegatingBindingTrace;
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilPackage;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystem;
import org.jetbrains.kotlin.resolve.calls.results.ResolutionStatus;
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind;
@@ -293,7 +293,7 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements MutableRe
@Override
public boolean isSafeCall() {
return CallUtilPackage.isSafeCall(call);
return CallUtilKt.isSafeCall(call);
}
@NotNull
@@ -306,7 +306,7 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements MutableRe
public boolean hasInferredReturnType() {
if (!completed) {
hasInferredReturnType = constraintSystem == null ||
CallResolverUtilPackage.hasInferredReturnType(candidateDescriptor, constraintSystem);
CallResolverUtilKt.hasInferredReturnType(candidateDescriptor, constraintSystem);
}
assert hasInferredReturnType != null : "The property 'hasInferredReturnType' was not set when the call was completed.";
return hasInferredReturnType;
@@ -244,8 +244,8 @@ public class OverloadingConflictResolver {
if (!isSubtype) return false;
Specificity.Relation sThanG = TypesPackage.getSpecificityRelationTo(specific, general);
Specificity.Relation gThanS = TypesPackage.getSpecificityRelationTo(general, specific);
Specificity.Relation sThanG = TypeCapabilitiesKt.getSpecificityRelationTo(specific, general);
Specificity.Relation gThanS = TypeCapabilitiesKt.getSpecificityRelationTo(general, specific);
if (sThanG == Specificity.Relation.LESS_SPECIFIC && gThanS != Specificity.Relation.LESS_SPECIFIC) {
return false;
}
@@ -20,7 +20,7 @@ import com.google.common.collect.Sets;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.descriptors.CallableDescriptor;
import org.jetbrains.kotlin.resolve.OverrideResolver;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.context.CheckArgumentTypesMode;
import org.jetbrains.kotlin.resolve.calls.model.MutableResolvedCall;
import org.jetbrains.kotlin.resolve.calls.tasks.ResolutionTask;
@@ -104,7 +104,7 @@ public class ResolutionResultsHandler {
// This check is needed for the following case:
// x.foo(unresolved) -- if there are multiple foo's, we'd report an ambiguity, and it does not make sense here
if (task.checkArguments != CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS ||
!CallUtilPackage.hasUnresolvedArguments(task.call, task)) {
!CallUtilKt.hasUnresolvedArguments(task.call, task)) {
if (allCandidatesIncomplete) {
task.tracing.cannotCompleteResolve(task.trace, results.getResultingCalls());
}
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.BindingContextUtils;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
@@ -264,7 +264,7 @@ public class DataFlowValueFactory {
) {
DeclarationDescriptor declarationDescriptor = bindingContext.get(REFERENCE_TARGET, simpleNameExpression);
if (declarationDescriptor instanceof VariableDescriptor) {
ResolvedCall<?> resolvedCall = CallUtilPackage.getResolvedCall(simpleNameExpression, bindingContext);
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(simpleNameExpression, bindingContext);
// todo uncomment assert
// KT-4113
@@ -28,13 +28,13 @@ import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.BindingTrace;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystem;
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemImpl;
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemStatus;
import org.jetbrains.kotlin.resolve.calls.inference.InferenceErrorData;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import org.jetbrains.kotlin.types.JetType;
@@ -69,7 +69,7 @@ public abstract class AbstractTracingStrategy implements TracingStrategy {
@Override
public void noValueForParameter(@NotNull BindingTrace trace, @NotNull ValueParameterDescriptor valueParameter) {
JetElement reportOn = CallUtilPackage.getValueArgumentListOrElement(call);
JetElement reportOn = CallUtilKt.getValueArgumentListOrElement(call);
trace.report(NO_VALUE_FOR_PARAMETER.on(reportOn, valueParameter));
}
@@ -140,7 +140,7 @@ public abstract class AbstractTracingStrategy implements TracingStrategy {
@NotNull ExplicitReceiverKind explicitReceiverKind
) {
if (explicitReceiverKind == ExplicitReceiverKind.NO_EXPLICIT_RECEIVER) {
DeclarationDescriptor importableDescriptor = DescriptorUtilPackage.getImportableDescriptor(classDescriptor);
DeclarationDescriptor importableDescriptor = DescriptorUtilsKt.getImportableDescriptor(classDescriptor);
if (DescriptorUtils.getFqName(importableDescriptor).isSafe()) {
FqName fqName = getFqNameFromTopLevelClass(importableDescriptor);
String qualifiedName;
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.psi.Call.CallType;
import org.jetbrains.kotlin.psi.debugText.DebugTextPackage;
import org.jetbrains.kotlin.psi.debugText.DebugTextUtilKt;
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import java.util.ArrayList;
@@ -326,7 +326,7 @@ public class CallMaker {
@Override
public String toString() {
return DebugTextPackage.getDebugText(callElement);
return DebugTextUtilKt.getDebugText(callElement);
}
@NotNull
@@ -119,7 +119,7 @@ public class DiagnosticsWithSuppression implements Diagnostics {
// there's no point to present such diagnostics to the user, because the user didn't write this code
PsiFile file = element.getContainingFile();
if (file instanceof JetFile) {
if (PsiPackage.getDoNotAnalyze((JetFile) file) != null) return true;
if (JetPsiFactoryKt.getDoNotAnalyze((JetFile) file) != null) return true;
}
for (DiagnosticSuppressor suppressor : DIAGNOSTIC_SUPPRESSORS.get()) {
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.BindingTrace;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.FunctionAnalyzerExtension;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import java.util.List;
@@ -79,7 +79,7 @@ public class InlineAnalyzerExtension implements FunctionAnalyzerExtension.Analyz
) {
List<JetParameter> jetParameters = function.getValueParameters();
for (ValueParameterDescriptor parameter : functionDescriptor.getValueParameters()) {
if (DescriptorUtilPackage.hasDefaultValue(parameter)) {
if (DescriptorUtilsKt.hasDefaultValue(parameter)) {
JetParameter jetParameter = jetParameters.get(parameter.getIndex());
//report not supported default only on inlinable lambda and on parameter with inherited default (there is some problems to inline it)
if (checkInlinableParameter(parameter, jetParameter, functionDescriptor, null) || !parameter.declaresDefaultValue()) {
@@ -27,11 +27,10 @@ import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.BindingTrace;
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import org.jetbrains.kotlin.resolve.calls.model.ArgumentMapping;
import org.jetbrains.kotlin.resolve.calls.model.ArgumentMatch;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.constants.ArrayValue;
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
import org.jetbrains.kotlin.resolve.constants.EnumValue;
@@ -106,9 +105,9 @@ public class InlineUtil {
JetExpression call = JetPsiUtil.getParentCallIfPresent(argument);
if (call != null) {
ResolvedCall<?> resolvedCall = CallUtilPackage.getResolvedCall(call, bindingContext);
ResolvedCall<?> resolvedCall = CallUtilKt.getResolvedCall(call, bindingContext);
if (resolvedCall != null && isInline(resolvedCall.getResultingDescriptor())) {
ValueArgument valueArgument = CallUtilPackage.getValueArgumentForExpression(resolvedCall.getCall(), argument);
ValueArgument valueArgument = CallUtilKt.getValueArgumentForExpression(resolvedCall.getCall(), argument);
if (valueArgument != null) {
ArgumentMapping mapping = resolvedCall.getArgumentMapping(valueArgument);
if (mapping instanceof ArgumentMatch) {
@@ -20,7 +20,7 @@ import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor;
import org.jetbrains.kotlin.resolve.scopes.LexicalScope;
@@ -73,7 +73,7 @@ public class DeclarationScopeProviderImpl implements DeclarationScopeProvider {
}
throw new IllegalStateException("Don't call this method for local declarations: " + jetDeclaration + "\n" +
PsiUtilPackage.getElementTextWithContext(jetDeclaration));
PsiUtilsKt.getElementTextWithContext(jetDeclaration));
}
@NotNull
@@ -20,14 +20,10 @@ import com.intellij.openapi.diagnostic.Logger;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.kotlin.descriptors.annotations.AnnotationWithTarget;
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
import org.jetbrains.kotlin.resolve.scopes.JetScope;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.TypeConstructor;
import org.jetbrains.kotlin.types.TypeProjection;
import org.jetbrains.kotlin.types.TypesPackage;
import org.jetbrains.kotlin.types.*;
import java.util.Collection;
@@ -95,9 +91,9 @@ public class ForceResolveUtil {
if (type == null) return null;
forceResolveAllContents(type.getAnnotations());
if (TypesPackage.isFlexible(type)) {
forceResolveAllContents(TypesPackage.flexibility(type).getLowerBound());
forceResolveAllContents(TypesPackage.flexibility(type).getUpperBound());
if (FlexibleTypesKt.isFlexible(type)) {
forceResolveAllContents(FlexibleTypesKt.flexibility(type).getLowerBound());
forceResolveAllContents(FlexibleTypesKt.flexibility(type).getUpperBound());
}
else {
forceResolveAllContents(type.getConstructor());
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt;
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.BindingTrace;
@@ -79,7 +79,7 @@ public class LazyDeclarationResolver {
throw new IllegalArgumentException(
String.format("Could not find a classifier for %s.\n" +
"Found descriptor: %s (%s).\n",
PsiUtilPackage.getElementTextWithContext(classOrObject),
PsiUtilsKt.getElementTextWithContext(classOrObject),
scopeDescriptor != null ? DescriptorRenderer.DEBUG_TEXT.render(scopeDescriptor) : "null",
scopeDescriptor != null ? (scopeDescriptor.getContainingDeclaration().getClass()) : null));
}
@@ -216,7 +216,7 @@ public class LazyDeclarationResolver {
@Override
public DeclarationDescriptor visitJetElement(@NotNull JetElement element, Void data) {
throw new IllegalArgumentException("Unsupported declaration type: " + element + " " +
PsiUtilPackage.getElementTextWithContext(element));
PsiUtilsKt.getElementTextWithContext(element));
}
}, null);
if (result == null) {
@@ -240,7 +240,7 @@ public class LazyDeclarationResolver {
return getClassDescriptor((JetClassOrObject) parentDeclaration, location).getUnsubstitutedMemberScope();
} else {
throw new IllegalStateException("Don't call this method for local declarations: " + declaration + "\n" +
PsiUtilPackage.getElementTextWithContext(declaration));
PsiUtilsKt.getElementTextWithContext(declaration));
}
}
}
@@ -25,10 +25,7 @@ import org.jetbrains.kotlin.descriptors.ClassifierDescriptor;
import org.jetbrains.kotlin.descriptors.ModuleDescriptor;
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor;
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.name.NamePackage;
import org.jetbrains.kotlin.name.SpecialNames;
import org.jetbrains.kotlin.name.*;
import org.jetbrains.kotlin.psi.JetNamedDeclaration;
import org.jetbrains.kotlin.psi.JetNamedDeclarationUtil;
import org.jetbrains.kotlin.resolve.scopes.JetScope;
@@ -61,7 +58,7 @@ public class ResolveSessionUtils {
while (true) {
PackageViewDescriptor packageDescriptor = module.getPackage(packageFqName);
if (!packageDescriptor.isEmpty()) {
FqName relativeClassFqName = NamePackage.tail(fqName, packageFqName);
FqName relativeClassFqName = FqNamesUtilKt.tail(fqName, packageFqName);
ClassDescriptor classDescriptor = findByQualifiedName(packageDescriptor.getMemberScope(), relativeClassFqName);
if (classDescriptor != null && filter.apply(classDescriptor)) {
result.add(classDescriptor);
@@ -48,6 +48,7 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.ClassMemberDeclarationProv
import org.jetbrains.kotlin.resolve.scopes.JetScope;
import org.jetbrains.kotlin.resolve.scopes.LexicalScope;
import org.jetbrains.kotlin.resolve.scopes.StaticScopeForKotlinClass;
import org.jetbrains.kotlin.resolve.source.KotlinSourceElementKt;
import org.jetbrains.kotlin.storage.MemoizedFunctionToNotNull;
import org.jetbrains.kotlin.storage.NotNullLazyValue;
import org.jetbrains.kotlin.storage.NullableLazyValue;
@@ -64,7 +65,6 @@ import static org.jetbrains.kotlin.diagnostics.Errors.CYCLIC_INHERITANCE_HIERARC
import static org.jetbrains.kotlin.diagnostics.Errors.TYPE_PARAMETERS_IN_ENUM;
import static org.jetbrains.kotlin.resolve.BindingContext.TYPE;
import static org.jetbrains.kotlin.resolve.ModifiersChecker.*;
import static org.jetbrains.kotlin.resolve.source.SourcePackage.toSourceElement;
public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDescriptorWithResolutionScopes, LazyEntity {
private static final Predicate<JetType> VALID_SUPERTYPE = new Predicate<JetType>() {
@@ -104,7 +104,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
@NotNull JetClassLikeInfo classLikeInfo
) {
super(c.getStorageManager(), containingDeclaration, name,
toSourceElement(classLikeInfo.getCorrespondingClassOrObject())
KotlinSourceElementKt.toSourceElement(classLikeInfo.getCorrespondingClassOrObject())
);
this.c = c;
@@ -25,12 +25,11 @@ import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil;
import org.jetbrains.kotlin.resolve.lazy.LazyClassContext;
import org.jetbrains.kotlin.resolve.lazy.LazyEntity;
import org.jetbrains.kotlin.resolve.source.KotlinSourceElementKt;
import org.jetbrains.kotlin.types.JetType;
import java.util.Set;
import static org.jetbrains.kotlin.resolve.source.SourcePackage.toSourceElement;
public class LazyTypeParameterDescriptor extends AbstractLazyTypeParameterDescriptor implements LazyEntity {
private final LazyClassContext c;
@@ -48,7 +47,7 @@ public class LazyTypeParameterDescriptor extends AbstractLazyTypeParameterDescri
jetTypeParameter.getVariance(),
jetTypeParameter.hasModifier(JetTokens.REIFIED_KEYWORD),
index,
toSourceElement(jetTypeParameter)
KotlinSourceElementKt.toSourceElement(jetTypeParameter)
);
this.c = c;
this.jetTypeParameter = jetTypeParameter;
@@ -35,8 +35,8 @@ import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.*;
import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilPackage;
import org.jetbrains.kotlin.resolve.callableReferences.CallableReferencesPackage;
import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilsKt;
import org.jetbrains.kotlin.resolve.callableReferences.CallableReferencesResolutionUtilsKt;
import org.jetbrains.kotlin.resolve.calls.ArgumentTypeResolver;
import org.jetbrains.kotlin.resolve.calls.CallExpressionResolver;
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker;
@@ -59,11 +59,11 @@ import org.jetbrains.kotlin.resolve.calls.util.CallMaker;
import org.jetbrains.kotlin.resolve.constants.*;
import org.jetbrains.kotlin.resolve.scopes.LexicalWritableScope;
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
import org.jetbrains.kotlin.resolve.scopes.utils.UtilsPackage;
import org.jetbrains.kotlin.resolve.scopes.utils.ScopeUtilsKt;
import org.jetbrains.kotlin.types.*;
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
import org.jetbrains.kotlin.types.expressions.unqualifiedSuper.UnqualifiedSuperPackage;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
import org.jetbrains.kotlin.types.expressions.unqualifiedSuper.UnqualifiedSuperKt;
import org.jetbrains.kotlin.util.OperatorNameConventions;
import org.jetbrains.kotlin.util.slicedMap.WritableSlice;
@@ -108,7 +108,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
public JetTypeInfo visitParenthesizedExpression(@NotNull JetParenthesizedExpression expression, ExpressionTypingContext context) {
JetExpression innerExpression = expression.getExpression();
if (innerExpression == null) {
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
return facade.getTypeInfo(innerExpression, context.replaceScope(context.scope));
}
@@ -125,7 +125,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
boolean hasError = constantChecker.checkConstantExpressionType(constantValue, expression, context.expectedType);
if (hasError) {
IElementType elementType = expression.getNode().getElementType();
return TypeInfoFactoryPackage.createTypeInfo(getDefaultType(elementType), context);
return TypeInfoFactoryKt.createTypeInfo(getDefaultType(elementType), context);
}
}
@@ -214,7 +214,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
) {
if (actualType == null || noExpectedType(targetType) || targetType.isError()) return;
if (TypesPackage.isDynamic(targetType)) {
if (DynamicTypesKt.isDynamic(targetType)) {
JetTypeReference right = expression.getRight();
assert right != null : "We know target is dynamic, but RHS is missing";
context.trace.report(DYNAMIC_NOT_ALLOWED.on(right));
@@ -319,7 +319,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
if (superTypeQualifier != null) {
components.typeResolver.resolveType(context.scope, superTypeQualifier, context.trace, true);
}
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
private JetType checkPossiblyQualifiedSuper(
@@ -380,9 +380,9 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
}
}
else {
if (UnqualifiedSuperPackage.isPossiblyAmbiguousUnqualifiedSuper(expression, supertypes)) {
if (UnqualifiedSuperKt.isPossiblyAmbiguousUnqualifiedSuper(expression, supertypes)) {
Collection<JetType> supertypesResolvedFromContext =
UnqualifiedSuperPackage.resolveUnqualifiedSuperFromExpressionContext(
UnqualifiedSuperKt.resolveUnqualifiedSuperFromExpressionContext(
expression, supertypes, components.builtIns.getAnyType());
if (supertypesResolvedFromContext.size() == 1) {
JetType singleResolvedType = supertypesResolvedFromContext.iterator().next();
@@ -415,7 +415,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
context.trace.record(BindingContext.REFERENCE_TARGET, expression.getInstanceReference(), result.getConstructor().getDeclarationDescriptor());
}
BindingContextUtilPackage.recordScope(context.trace, context.scope, superTypeQualifier);
BindingContextUtilsKt.recordScope(context.trace, context.scope, superTypeQualifier);
return result;
}
@@ -440,7 +440,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
}
else {
ReceiverParameterDescriptor result = null;
List<ReceiverParameterDescriptor> receivers = UtilsPackage.getImplicitReceiversHierarchy(context.scope);
List<ReceiverParameterDescriptor> receivers = ScopeUtilsKt.getImplicitReceiversHierarchy(context.scope);
if (onlyClassReceivers) {
for (ReceiverParameterDescriptor receiver : receivers) {
if (isDeclaredInClass(receiver)) {
@@ -508,7 +508,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
);
}
return TypeInfoFactoryPackage.createTypeInfo(ErrorUtils.createErrorType("Unresolved class"), c);
return TypeInfoFactoryKt.createTypeInfo(ErrorUtils.createErrorType("Unresolved class"), c);
}
@Nullable
@@ -665,9 +665,9 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
}
}
// Breaks are not possible inside constructor arguments, so jumpPossible or jumpFlowInfo are not necessary here
JetTypeInfo resultTypeInfo = components.dataFlowAnalyzer.checkType(TypeInfoFactoryPackage.createTypeInfo(result[0], resultFlowInfo),
expression,
context);
JetTypeInfo resultTypeInfo = components.dataFlowAnalyzer.checkType(TypeInfoFactoryKt.createTypeInfo(result[0], resultFlowInfo),
expression,
context);
// We have to record it here,
// otherwise ExpressionTypingVisitorDispatcher records wrong information
context.trace.record(EXPRESSION_TYPE_INFO, expression, resultTypeInfo);
@@ -684,7 +684,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
JetSimpleNameExpression reference = expression.getCallableReference();
boolean[] resolved = new boolean[1];
CallableDescriptor descriptor = CallableReferencesPackage.resolveCallableReferenceTarget(
CallableDescriptor descriptor = CallableReferencesResolutionUtilsKt.resolveCallableReferenceTarget(
expression, lhsType, context, resolved, components.callResolver);
if (!resolved[0]) {
context.trace.report(UNRESOLVED_REFERENCE.on(reference, reference));
@@ -700,7 +700,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
context.trace.report(CALLABLE_REFERENCE_TO_OBJECT_MEMBER.on(reference));
}
return CallableReferencesPackage.createReflectionTypeForResolvedCallableReference(expression, descriptor, context, components.reflectionTypes);
return CallableReferencesResolutionUtilsKt.createReflectionTypeForResolvedCallableReference(expression, descriptor, context, components.reflectionTypes);
}
@Override
@@ -722,7 +722,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
: contextWithExpectedType.replaceContextDependency(INDEPENDENT).replaceExpectedType(NO_EXPECTED_TYPE);
JetExpression baseExpression = expression.getBaseExpression();
if (baseExpression == null) return TypeInfoFactoryPackage.noTypeInfo(context);
if (baseExpression == null) return TypeInfoFactoryKt.noTypeInfo(context);
JetSimpleNameExpression operationSign = expression.getOperationReference();
@@ -870,7 +870,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
UnderscoreChecker.INSTANCE$.checkIdentifier(labelIdentifier, context.trace);
}
JetExpression baseExpression = expression.getBaseExpression();
if (baseExpression == null) return TypeInfoFactoryPackage.noTypeInfo(context);
if (baseExpression == null) return TypeInfoFactoryKt.noTypeInfo(context);
return facade.getTypeInfo(baseExpression, context, isStatement);
}
@@ -996,7 +996,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
context.trace.record(REFERENCE_TARGET, operationSign, components.builtIns.getIdentityEquals());
ensureNonemptyIntersectionOfOperandTypes(expression, context);
// TODO : Check comparison pointlessness
result = TypeInfoFactoryPackage.createTypeInfo(components.builtIns.getBooleanType(), context);
result = TypeInfoFactoryKt.createTypeInfo(components.builtIns.getBooleanType(), context);
}
else if (OperatorConventions.IN_OPERATIONS.contains(operationType)) {
ValueArgument leftArgument = CallMaker.makeValueArgument(left, left != null ? left : operationSign);
@@ -1007,7 +1007,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
}
else {
context.trace.report(UNSUPPORTED.on(operationSign, "Unknown operation"));
result = TypeInfoFactoryPackage.noTypeInfo(context);
result = TypeInfoFactoryKt.noTypeInfo(context);
}
CompileTimeConstant<?> value = components.constantExpressionEvaluator.evaluateExpression(
expression, contextWithExpectedType.trace, contextWithExpectedType.expectedType
@@ -1028,7 +1028,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
if (right == null || left == null) {
ExpressionTypingUtils.getTypeInfoOrNullType(right, context, facade);
ExpressionTypingUtils.getTypeInfoOrNullType(left, context, facade);
return TypeInfoFactoryPackage.createTypeInfo(components.builtIns.getBooleanType(), context);
return TypeInfoFactoryKt.createTypeInfo(components.builtIns.getBooleanType(), context);
}
JetTypeInfo leftTypeInfo = getTypeInfoOrNullType(left, context, facade);
@@ -1150,7 +1150,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
if (left == null || right == null) {
getTypeInfoOrNullType(left, context, facade);
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
Call call = createCallForSpecialConstruction(expression, expression.getOperationReference(), Lists.newArrayList(left, right));
@@ -1159,7 +1159,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
JetTypeInfo leftTypeInfo = BindingContextUtils.getRecordedTypeInfo(left, context.trace.getBindingContext());
if (ArgumentTypeResolver.isFunctionLiteralArgument(left, context)) {
context.trace.report(USELESS_ELVIS_ON_FUNCTION_LITERAL.on(expression.getOperationReference()));
if (leftTypeInfo == null) return TypeInfoFactoryPackage.noTypeInfo(context);
if (leftTypeInfo == null) return TypeInfoFactoryKt.noTypeInfo(context);
}
assert leftTypeInfo != null : "Left expression was not processed: " + expression;
JetType leftType = leftTypeInfo.getType();
@@ -1169,7 +1169,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
JetTypeInfo rightTypeInfo = BindingContextUtils.getRecordedTypeInfo(right, context.trace.getBindingContext());
if (rightTypeInfo == null && ArgumentTypeResolver.isFunctionLiteralArgument(right, context)) {
// the type is computed later in call completer according to the '?:' semantics as a function
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
assert rightTypeInfo != null : "Right expression was not processed: " + expression;
boolean loopBreakContinuePossible = leftTypeInfo.getJumpOutPossible() || rightTypeInfo.getJumpOutPossible();
@@ -1187,7 +1187,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
}
}
JetType type = resolvedCall.getResultingDescriptor().getReturnType();
if (type == null || rightType == null) return TypeInfoFactoryPackage.noTypeInfo(dataFlowInfo);
if (type == null || rightType == null) return TypeInfoFactoryKt.noTypeInfo(dataFlowInfo);
// Sometimes return type for special call for elvis operator might be nullable,
// but result is not nullable if the right type is not nullable
@@ -1195,14 +1195,14 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
type = TypeUtils.makeNotNullable(type);
}
if (context.contextDependency == DEPENDENT) {
return TypeInfoFactoryPackage.createTypeInfo(type, dataFlowInfo);
return TypeInfoFactoryKt.createTypeInfo(type, dataFlowInfo);
}
// If break or continue was possible, take condition check info as the jump info
return TypeInfoFactoryPackage.createTypeInfo(components.dataFlowAnalyzer.checkType(type, expression, contextWithExpectedType),
dataFlowInfo,
loopBreakContinuePossible,
context.dataFlowInfo);
return TypeInfoFactoryKt.createTypeInfo(components.dataFlowAnalyzer.checkType(type, expression, contextWithExpectedType),
dataFlowInfo,
loopBreakContinuePossible,
context.dataFlowInfo);
}
@NotNull
@@ -1217,7 +1217,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
ExpressionTypingContext contextWithNoExpectedType = context.replaceExpectedType(NO_EXPECTED_TYPE);
if (right == null) {
if (left != null) facade.getTypeInfo(left, contextWithNoExpectedType);
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
JetTypeInfo rightTypeInfo = facade.getTypeInfo(right, contextWithNoExpectedType);
@@ -1310,7 +1310,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
private JetTypeInfo assignmentIsNotAnExpressionError(JetBinaryExpression expression, ExpressionTypingContext context) {
facade.checkStatementType(expression, context);
context.trace.report(ASSIGNMENT_IN_EXPRESSION_CONTEXT.on(expression));
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
@Override
@@ -1330,7 +1330,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
//left here is a receiver, so it doesn't depend on expected type
typeInfo = facade.getTypeInfo(left, context.replaceContextDependency(INDEPENDENT).replaceExpectedType(NO_EXPECTED_TYPE));
} else {
typeInfo = TypeInfoFactoryPackage.noTypeInfo(context);
typeInfo = TypeInfoFactoryKt.noTypeInfo(context);
}
ExpressionTypingContext contextWithDataFlow = context.replaceDataFlowInfo(typeInfo.getDataFlowInfo());
@@ -1356,7 +1356,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
@Override
public JetTypeInfo visitDeclaration(@NotNull JetDeclaration dcl, ExpressionTypingContext context) {
context.trace.report(DECLARATION_IN_ILLEGAL_CONTEXT.on(dcl));
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
@Override
@@ -1364,14 +1364,14 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
if (!JetPsiUtil.isLHSOfDot(expression)) {
context.trace.report(PACKAGE_IS_NOT_AN_EXPRESSION.on(expression));
}
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
@Override
public JetTypeInfo visitStringTemplateExpression(@NotNull JetStringTemplateExpression expression, ExpressionTypingContext contextWithExpectedType) {
final ExpressionTypingContext context = contextWithExpectedType.replaceExpectedType(NO_EXPECTED_TYPE).replaceContextDependency(INDEPENDENT);
class StringTemplateVisitor extends JetVisitorVoid {
private JetTypeInfo typeInfo = TypeInfoFactoryPackage.noTypeInfo(context);
private JetTypeInfo typeInfo = TypeInfoFactoryKt.noTypeInfo(context);
@Override
public void visitStringTemplateEntryWithExpression(@NotNull JetStringTemplateEntryWithExpression entry) {
@@ -1410,7 +1410,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
JetExpression baseExpression = expression.getBaseExpression();
if (baseExpression == null) {
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
return facade.getTypeInfo(baseExpression, context, isStatement);
}
@@ -1418,7 +1418,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
@Override
public JetTypeInfo visitJetElement(@NotNull JetElement element, ExpressionTypingContext context) {
context.trace.report(UNSUPPORTED.on(element, getClass().getCanonicalName()));
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
@NotNull
@@ -1438,7 +1438,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
@NotNull BindingTrace traceForResolveResult,
boolean isGet) {
JetExpression arrayExpression = arrayAccessExpression.getArrayExpression();
if (arrayExpression == null) return TypeInfoFactoryPackage.noTypeInfo(oldContext);
if (arrayExpression == null) return TypeInfoFactoryKt.noTypeInfo(oldContext);
JetTypeInfo arrayTypeInfo = facade.safeGetTypeInfo(arrayExpression, oldContext.replaceExpectedType(NO_EXPECTED_TYPE)
@@ -30,18 +30,19 @@ import org.jetbrains.kotlin.resolve.*;
import org.jetbrains.kotlin.resolve.calls.model.MutableDataFlowInfoForArguments;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
import org.jetbrains.kotlin.resolve.scopes.LexicalScope;
import org.jetbrains.kotlin.resolve.scopes.LexicalWritableScope;
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver;
import org.jetbrains.kotlin.resolve.scopes.utils.UtilsPackage;
import org.jetbrains.kotlin.resolve.scopes.utils.ScopeUtilsKt;
import org.jetbrains.kotlin.types.CommonSupertypes;
import org.jetbrains.kotlin.types.ErrorUtils;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.TypeUtils;
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
import java.util.ArrayList;
import java.util.Collections;
@@ -51,7 +52,6 @@ import static org.jetbrains.kotlin.diagnostics.Errors.*;
import static org.jetbrains.kotlin.psi.PsiPackage.JetPsiFactory;
import static org.jetbrains.kotlin.resolve.BindingContext.*;
import static org.jetbrains.kotlin.resolve.calls.context.ContextDependency.INDEPENDENT;
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
import static org.jetbrains.kotlin.types.TypeUtils.*;
import static org.jetbrains.kotlin.types.expressions.ControlStructureTypingUtils.createCallForSpecialConstruction;
import static org.jetbrains.kotlin.types.expressions.ControlStructureTypingUtils.createDataFlowInfoForArgumentsForIfCall;
@@ -111,18 +111,18 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
? result.replaceJumpOutPossible(true).replaceJumpFlowInfo(conditionDataFlowInfo)
: result;
}
return TypeInfoFactoryPackage.createTypeInfo(components.dataFlowAnalyzer.checkImplicitCast(
return TypeInfoFactoryKt.createTypeInfo(components.dataFlowAnalyzer.checkImplicitCast(
components.builtIns.getUnitType(), ifExpression,
contextWithExpectedType, isStatement
),
thenInfo.or(elseInfo)
thenInfo.or(elseInfo)
);
}
if (thenBranch == null) {
return getTypeInfoWhenOnlyOneBranchIsPresent(
elseBranch, elseScope, elseInfo, thenInfo, contextWithExpectedType, ifExpression, isStatement);
}
JetPsiFactory psiFactory = JetPsiFactory(ifExpression);
JetPsiFactory psiFactory = JetPsiFactoryKt.JetPsiFactory(ifExpression);
JetBlockExpression thenBlock = psiFactory.wrapInABlockWrapper(thenBranch);
JetBlockExpression elseBlock = psiFactory.wrapInABlockWrapper(elseBranch);
Call callForIf = createCallForSpecialConstruction(ifExpression, ifExpression, Lists.newArrayList(thenBlock, elseBlock));
@@ -164,7 +164,7 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
JetType resultType = resolvedCall.getResultingDescriptor().getReturnType();
// If break or continue was possible, take condition check info as the jump info
return TypeInfoFactoryPackage
return TypeInfoFactoryKt
.createTypeInfo(components.dataFlowAnalyzer.checkImplicitCast(resultType, ifExpression, contextWithExpectedType, isStatement),
resultDataFlowInfo, loopBreakContinuePossible, conditionDataFlowInfo);
}
@@ -232,7 +232,7 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
CoercionStrategy.NO_COERCION, context.replaceDataFlowInfo(conditionInfo));
}
else {
bodyTypeInfo = TypeInfoFactoryPackage.noTypeInfo(conditionInfo);
bodyTypeInfo = TypeInfoFactoryKt.noTypeInfo(conditionInfo);
}
// Condition is false at this point only if there is no jumps outside
@@ -332,7 +332,7 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
writableScope, block, CoercionStrategy.NO_COERCION, context);
}
else {
bodyTypeInfo = TypeInfoFactoryPackage.noTypeInfo(context);
bodyTypeInfo = TypeInfoFactoryKt.noTypeInfo(context);
}
JetExpression condition = expression.getCondition();
DataFlowInfo conditionDataFlowInfo = checkCondition(conditionScope, condition, context);
@@ -384,7 +384,7 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
}
}
else {
loopRangeInfo = TypeInfoFactoryPackage.noTypeInfo(context);
loopRangeInfo = TypeInfoFactoryKt.noTypeInfo(context);
}
LexicalWritableScope loopScope = newWritableScopeImpl(context, "Scope with for-loop index");
@@ -455,7 +455,7 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
{
// http://youtrack.jetbrains.net/issue/KT-527
VariableDescriptor olderVariable = UtilsPackage.getLocalVariable(context.scope, variableDescriptor.getName());
VariableDescriptor olderVariable = ScopeUtilsKt.getLocalVariable(context.scope, variableDescriptor.getName());
if (olderVariable != null && isLocal(context.scope.getOwnerDescriptor(), olderVariable)) {
PsiElement declaration = DescriptorToSourceUtils.descriptorToDeclaration(variableDescriptor);
context.trace.report(Errors.NAME_SHADOWING.on(declaration, variableDescriptor.getName().asString()));
@@ -495,7 +495,7 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
}
}
JetTypeInfo result = TypeInfoFactoryPackage.noTypeInfo(context);
JetTypeInfo result = TypeInfoFactoryKt.noTypeInfo(context);
if (finallyBlock != null) {
result = facade.getTypeInfo(finallyBlock.getFinalExpression(),
context.replaceExpectedType(NO_EXPECTED_TYPE));
@@ -624,7 +624,7 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
) {
JetType expectedType;
if (function instanceof JetSecondaryConstructor) {
expectedType = getBuiltIns(descriptor).getUnitType();
expectedType = DescriptorUtilsKt.getBuiltIns(descriptor).getUnitType();
}
else if (function instanceof JetFunction) {
JetFunction jetFunction = (JetFunction) function;
@@ -31,11 +31,11 @@ import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext;
import org.jetbrains.kotlin.resolve.calls.smartcasts.*;
import org.jetbrains.kotlin.resolve.constants.*;
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator;
import org.jetbrains.kotlin.types.DynamicTypesKt;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.TypeUtils;
import org.jetbrains.kotlin.types.TypesPackage;
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
import java.util.Collection;
@@ -258,7 +258,7 @@ public class DataFlowAnalyzer {
public JetType checkImplicitCast(@Nullable JetType expressionType, @NotNull JetExpression expression, @NotNull ResolutionContext context, boolean isStatement) {
if (expressionType != null && context.expectedType == NO_EXPECTED_TYPE && context.contextDependency == INDEPENDENT && !isStatement
&& (KotlinBuiltIns.isUnit(expressionType) || KotlinBuiltIns.isAnyOrNullableAny(expressionType))
&& !TypesPackage.isDynamic(expressionType)) {
&& !DynamicTypesKt.isDynamic(expressionType)) {
context.trace.report(IMPLICIT_CAST_TO_UNIT_OR_ANY.on(expression, expressionType));
}
return expressionType;
@@ -274,7 +274,7 @@ public class DataFlowAnalyzer {
facade.checkStatementType(
expression, context.replaceExpectedType(TypeUtils.NO_EXPECTED_TYPE).replaceContextDependency(INDEPENDENT));
context.trace.report(EXPRESSION_EXPECTED.on(expression, expression));
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
@NotNull
@@ -298,7 +298,7 @@ public class DataFlowAnalyzer {
@NotNull ResolutionContext<?> context,
@NotNull JetExpression expression
) {
return checkType(TypeInfoFactoryPackage.createTypeInfo(type, context), expression, context);
return checkType(TypeInfoFactoryKt.createTypeInfo(type, context), expression, context);
}
@NotNull
@@ -32,10 +32,10 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
import org.jetbrains.kotlin.resolve.scopes.LexicalScope;
import org.jetbrains.kotlin.resolve.scopes.LexicalWritableScope;
import org.jetbrains.kotlin.resolve.scopes.WritableScope;
import org.jetbrains.kotlin.resolve.scopes.utils.UtilsPackage;
import org.jetbrains.kotlin.resolve.scopes.utils.ScopeUtilsKt;
import org.jetbrains.kotlin.types.ErrorUtils;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
import java.util.Iterator;
import java.util.List;
@@ -158,7 +158,7 @@ public class ExpressionTypingServices {
@NotNull CoercionStrategy coercionStrategyForLastExpression,
@NotNull ExpressionTypingContext context
) {
List<JetExpression> block = ResolvePackage.filterStatements(statementFilter, expression);
List<JetExpression> block = StatementFilterKt.filterStatements(statementFilter, expression);
// SCRIPT: get code descriptor for script declaration
DeclarationDescriptor containingDescriptor = context.scope.getOwnerDescriptor();
@@ -185,7 +185,7 @@ public class ExpressionTypingServices {
scope.changeLockLevel(WritableScope.LockLevel.READING);
if (containingDescriptor instanceof ScriptDescriptor) {
context.trace.record(BindingContext.SCRIPT_SCOPE, (ScriptDescriptor) containingDescriptor, UtilsPackage.asJetScope(scope));
context.trace.record(BindingContext.SCRIPT_SCOPE, (ScriptDescriptor) containingDescriptor, ScopeUtilsKt.asJetScope(scope));
}
return r;
@@ -229,14 +229,14 @@ public class ExpressionTypingServices {
@NotNull ExpressionTypingContext context
) {
if (block.isEmpty()) {
return TypeInfoFactoryPackage.createTypeInfo(expressionTypingComponents.builtIns.getUnitType(), context);
return TypeInfoFactoryKt.createTypeInfo(expressionTypingComponents.builtIns.getUnitType(), context);
}
ExpressionTypingInternals blockLevelVisitor = new ExpressionTypingVisitorDispatcher.ForBlock(
expressionTypingComponents, annotationChecker, scope);
ExpressionTypingContext newContext = context.replaceScope(scope).replaceExpectedType(NO_EXPECTED_TYPE);
JetTypeInfo result = TypeInfoFactoryPackage.noTypeInfo(context);
JetTypeInfo result = TypeInfoFactoryKt.noTypeInfo(context);
// Jump point data flow info
DataFlowInfo beforeJumpInfo = newContext.dataFlowInfo;
boolean jumpOutPossible = false;
@@ -35,7 +35,7 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ClassReceiver;
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
import java.util.ArrayList;
import java.util.List;
@@ -114,7 +114,7 @@ public class ExpressionTypingUtils {
@NotNull String argumentName,
@NotNull JetType argumentType
) {
JetExpression fakeExpression = JetPsiFactory(project).createExpression(argumentName);
JetExpression fakeExpression = JetPsiFactoryKt.JetPsiFactory(project).createExpression(argumentName);
trace.recordType(fakeExpression, argumentType);
trace.record(PROCESSED, fakeExpression);
return fakeExpression;
@@ -164,7 +164,7 @@ public class ExpressionTypingUtils {
) {
return expression != null
? facade.getTypeInfo(expression, context)
: TypeInfoFactoryPackage.noTypeInfo(context);
: TypeInfoFactoryKt.noTypeInfo(context);
}
@SuppressWarnings("SuspiciousMethodCalls")
@@ -27,18 +27,17 @@ import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.AnnotationChecker;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.BindingContextUtils;
import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilsKt;
import org.jetbrains.kotlin.resolve.scopes.LexicalWritableScope;
import org.jetbrains.kotlin.types.DeferredType;
import org.jetbrains.kotlin.types.ErrorUtils;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
import org.jetbrains.kotlin.util.PerformanceCounter;
import org.jetbrains.kotlin.util.ReenteringLazyValueComputationException;
import org.jetbrains.kotlin.utils.KotlinFrontEndException;
import static org.jetbrains.kotlin.diagnostics.Errors.TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM;
import static org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilPackage.recordDataFlowInfo;
import static org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilPackage.recordScope;
public abstract class ExpressionTypingVisitorDispatcher extends JetVisitor<JetTypeInfo, ExpressionTypingContext> implements ExpressionTypingInternals {
@@ -182,14 +181,14 @@ public abstract class ExpressionTypingVisitorDispatcher extends JetVisitor<JetTy
}
catch (ReenteringLazyValueComputationException e) {
context.trace.report(TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM.on(expression));
result = TypeInfoFactoryPackage.noTypeInfo(context);
result = TypeInfoFactoryKt.noTypeInfo(context);
}
context.trace.record(BindingContext.PROCESSED, expression);
// todo save scope before analyze and fix debugger: see CodeFragmentAnalyzer.correctContextForExpression
recordScope(context.trace, context.scope, expression);
recordDataFlowInfo(context.replaceDataFlowInfo(result.getDataFlowInfo()), expression);
BindingContextUtilsKt.recordScope(context.trace, context.scope, expression);
BindingContextUtilsKt.recordDataFlowInfo(context.replaceDataFlowInfo(result.getDataFlowInfo()), expression);
return result;
}
catch (ProcessCanceledException e) {
@@ -201,7 +200,7 @@ public abstract class ExpressionTypingVisitorDispatcher extends JetVisitor<JetTy
catch (Throwable e) {
context.trace.report(Errors.EXCEPTION_FROM_ANALYZER.on(expression, e));
logOrThrowException(expression, e);
return TypeInfoFactoryPackage.createTypeInfo(
return TypeInfoFactoryKt.createTypeInfo(
ErrorUtils.createErrorType(e.getClass().getSimpleName() + " from analyzer"),
context
);
@@ -41,11 +41,11 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValue;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory;
import org.jetbrains.kotlin.resolve.scopes.LexicalWritableScope;
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
import org.jetbrains.kotlin.resolve.scopes.utils.UtilsPackage;
import org.jetbrains.kotlin.resolve.scopes.utils.ScopeUtilsKt;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.TypeUtils;
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
import java.util.Collection;
@@ -101,7 +101,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
scope, context.replaceScope(scope).replaceContextDependency(INDEPENDENT),
scope.getOwnerDescriptor(),
declaration);
return TypeInfoFactoryPackage.createTypeInfo(components.dataFlowAnalyzer.checkStatementType(declaration, context), context);
return TypeInfoFactoryKt.createTypeInfo(components.dataFlowAnalyzer.checkStatementType(declaration, context), context);
}
@Override
@@ -155,11 +155,11 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
}
}
else {
typeInfo = TypeInfoFactoryPackage.noTypeInfo(context);
typeInfo = TypeInfoFactoryKt.noTypeInfo(context);
}
{
VariableDescriptor olderVariable = UtilsPackage.getLocalVariable(scope, propertyDescriptor.getName());
VariableDescriptor olderVariable = ScopeUtilsKt.getLocalVariable(scope, propertyDescriptor.getName());
ExpressionTypingUtils.checkVariableShadowing(context, propertyDescriptor, olderVariable);
}
@@ -176,13 +176,13 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
JetExpression initializer = multiDeclaration.getInitializer();
if (initializer == null) {
context.trace.report(INITIALIZER_REQUIRED_FOR_MULTIDECLARATION.on(multiDeclaration));
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
ExpressionReceiver expressionReceiver = ExpressionTypingUtils.getExpressionReceiver(
facade, initializer, context.replaceExpectedType(NO_EXPECTED_TYPE).replaceContextDependency(INDEPENDENT));
JetTypeInfo typeInfo = facade.getTypeInfo(initializer, context);
if (expressionReceiver == null) {
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
components.multiDeclarationResolver.defineLocalVariablesFromMultiDeclaration(scope, multiDeclaration, expressionReceiver, initializer, context);
components.modifiersChecker.withTrace(context.trace).checkModifiersForMultiDeclaration(multiDeclaration);
@@ -201,7 +201,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
scope, context.replaceScope(scope).replaceContextDependency(INDEPENDENT),
scope.getOwnerDescriptor(),
klass);
return TypeInfoFactoryPackage.createTypeInfo(components.dataFlowAnalyzer.checkStatementType(klass, context), context);
return TypeInfoFactoryKt.createTypeInfo(components.dataFlowAnalyzer.checkStatementType(klass, context), context);
}
@Override
@@ -212,7 +212,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
@Override
public JetTypeInfo visitDeclaration(@NotNull JetDeclaration dcl, ExpressionTypingContext context) {
return TypeInfoFactoryPackage.createTypeInfo(components.dataFlowAnalyzer.checkStatementType(dcl, context), context);
return TypeInfoFactoryKt.createTypeInfo(components.dataFlowAnalyzer.checkStatementType(dcl, context), context);
}
@Override
@@ -346,7 +346,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
JetExpression right = expression.getRight();
if (left instanceof JetArrayAccessExpression) {
JetArrayAccessExpression arrayAccessExpression = (JetArrayAccessExpression) left;
if (right == null) return TypeInfoFactoryPackage.noTypeInfo(context);
if (right == null) return TypeInfoFactoryKt.noTypeInfo(context);
JetTypeInfo typeInfo = basic.resolveArrayAccessSetMethod(arrayAccessExpression, right, context, context.trace);
basic.checkLValue(context.trace, context, arrayAccessExpression, right);
return typeInfo.replaceType(checkAssignmentType(typeInfo.getType(), expression, contextWithExpectedType));
@@ -384,7 +384,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
@Override
public JetTypeInfo visitJetElement(@NotNull JetElement element, ExpressionTypingContext context) {
context.trace.report(UNSUPPORTED.on(element, "in a block"));
return TypeInfoFactoryPackage.noTypeInfo(context);
return TypeInfoFactoryKt.noTypeInfo(context);
}
@Override
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.*;
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext;
import org.jetbrains.kotlin.resolve.scopes.utils.UtilsPackage;
import org.jetbrains.kotlin.resolve.scopes.utils.ScopeUtilsKt;
import java.util.Collection;
import java.util.Set;
@@ -141,7 +141,7 @@ public class LabelResolver {
Name labelName = expression.getLabelNameAsName();
if (labelElement == null || labelName == null) return null;
Collection<DeclarationDescriptor> declarationsByLabel = UtilsPackage.getDeclarationsByLabel(context.scope, labelName);
Collection<DeclarationDescriptor> declarationsByLabel = ScopeUtilsKt.getDeclarationsByLabel(context.scope, labelName);
int size = declarationsByLabel.size();
if (size > 1) {
@@ -194,7 +194,7 @@ public class LabelResolver {
JetSimpleNameExpression targetLabel = expression.getTargetLabel();
assert targetLabel != null : expression;
Collection<DeclarationDescriptor> declarationsByLabel = UtilsPackage.getDeclarationsByLabel(context.scope, labelName);
Collection<DeclarationDescriptor> declarationsByLabel = ScopeUtilsKt.getDeclarationsByLabel(context.scope, labelName);
int size = declarationsByLabel.size();
if (size == 1) {
DeclarationDescriptor declarationDescriptor = declarationsByLabel.iterator().next();
@@ -36,7 +36,7 @@ import org.jetbrains.kotlin.resolve.calls.util.CallMaker;
import org.jetbrains.kotlin.resolve.scopes.LexicalWritableScope;
import org.jetbrains.kotlin.types.*;
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryPackage;
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.TypeInfoFactoryKt;
import java.util.Collections;
import java.util.Set;
@@ -142,14 +142,14 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
commonDataFlowInfo = commonDataFlowInfo.or(context.dataFlowInfo);
}
return TypeInfoFactoryPackage.createTypeInfo(expressionTypes.isEmpty() ? null : components.dataFlowAnalyzer.checkType(
return TypeInfoFactoryKt.createTypeInfo(expressionTypes.isEmpty() ? null : components.dataFlowAnalyzer.checkType(
components.dataFlowAnalyzer.checkImplicitCast(
CommonSupertypes.commonSupertype(expressionTypes), expression,
contextWithExpectedType, isStatement),
expression, contextWithExpectedType),
commonDataFlowInfo,
loopBreakContinuePossible,
contextWithExpectedType.dataFlowInfo);
commonDataFlowInfo,
loopBreakContinuePossible,
contextWithExpectedType.dataFlowInfo);
}
@NotNull
@@ -309,7 +309,7 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
PossiblyBareType possiblyBareTarget = components.typeResolver.resolvePossiblyBareType(typeResolutionContext, typeReferenceAfterIs);
JetType targetType = TypeReconstructionUtil.reconstructBareType(typeReferenceAfterIs, possiblyBareTarget, subjectType, context.trace, components.builtIns);
if (TypesPackage.isDynamic(targetType)) {
if (DynamicTypesKt.isDynamic(targetType)) {
context.trace.report(DYNAMIC_NOT_ALLOWED.on(typeReferenceAfterIs));
}
ClassDescriptor targetDescriptor = TypeUtils.getClassDescriptor(targetType);
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.util.slicedMap;
import com.intellij.openapi.diagnostic.Logger;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.JetElement;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt;
import java.util.Arrays;
import java.util.List;
@@ -41,7 +41,7 @@ public class Slices {
" key: " + key +
" old value: " + oldValue + '@' + System.identityHashCode(oldValue) +
" new value: " + newValue + '@' + System.identityHashCode(newValue) +
(key instanceof JetElement ? "\n" + PsiUtilPackage.getElementTextWithContext((JetElement) key) : ""));
(key instanceof JetElement ? "\n" + PsiUtilsKt.getElementTextWithContext((JetElement) key) : ""));
}
return true;
}