More renames of TypeRef to TypeReference

This commit is contained in:
Valentin Kipyatkov
2014-10-07 12:54:05 +04:00
parent 31ebee81f0
commit 852fc8bc5d
41 changed files with 70 additions and 73 deletions
@@ -3692,7 +3692,7 @@ The "returned" value of try expression with no finally is either the last expres
@Override
public StackValue visitIsExpression(@NotNull JetIsExpression expression, StackValue receiver) {
StackValue match = StackValue.expression(OBJECT_TYPE, expression.getLeftHandSide(), this);
return generateIsCheck(match, expression.getTypeRef(), expression.isNegated());
return generateIsCheck(match, expression.getTypeReference(), expression.isNegated());
}
private StackValue generateExpressionMatch(StackValue expressionToMatch, JetExpression patternExpression) {
@@ -3844,7 +3844,7 @@ The "returned" value of try expression with no finally is either the last expres
StackValue.Local match = subjectLocal == -1 ? null : StackValue.local(subjectLocal, subjectType);
if (condition instanceof JetWhenConditionIsPattern) {
JetWhenConditionIsPattern patternCondition = (JetWhenConditionIsPattern) condition;
return generateIsCheck(match, patternCondition.getTypeRef(), patternCondition.isNegated());
return generateIsCheck(match, patternCondition.getTypeReference(), patternCondition.isNegated());
}
else if (condition instanceof JetWhenConditionWithExpression) {
JetExpression patternExpression = ((JetWhenConditionWithExpression) condition).getExpression();
@@ -142,7 +142,7 @@ public class PropertyCodegen {
if (declaration == null) return true;
// Delegated or extension properties can only be referenced via accessors
if (declaration.hasDelegate() || declaration.getReceiverTypeRef() != null) return true;
if (declaration.hasDelegate() || declaration.getReceiverTypeReference() != null) return true;
// Class object properties always should have accessors, because their backing fields are moved/copied to the outer class
if (isClassObject(descriptor.getContainingDeclaration())) return true;
@@ -83,7 +83,7 @@ public class TypeTransformingVisitor extends JetVisitor<JetType, Void> {
@Override
public JetType visitFunctionType(@NotNull JetFunctionType type, Void data) {
return visitCommonType(type.getReceiverTypeRef() == null
return visitCommonType(type.getReceiverTypeReference() == null
? KotlinBuiltIns.getInstance().getFunction(type.getParameters().size())
: KotlinBuiltIns.getInstance().getExtensionFunction(type.getParameters().size()), type);
}
@@ -167,9 +167,9 @@ private object DebugTextBuildingVisitor : JetVisitor<String, Unit>() {
override fun visitFunctionType(functionType: JetFunctionType, data: Unit?): String? {
return buildText {
appendInn(functionType.getReceiverTypeRef(), suffix = ".")
appendInn(functionType.getReceiverTypeReference(), suffix = ".")
appendInn(functionType.getParameterList())
appendInn(functionType.getReturnTypeRef(), prefix = " -> ")
appendInn(functionType.getReturnTypeReference(), prefix = " -> ")
}
}
@@ -260,7 +260,7 @@ private object DebugTextBuildingVisitor : JetVisitor<String, Unit>() {
if (function.hasTypeParameterListBeforeFunctionName()) {
appendInn(typeParameterList, suffix = " ")
}
appendInn(function.getReceiverTypeRef(), suffix = ".")
appendInn(function.getReceiverTypeReference(), suffix = ".")
appendInn(function.getNameAsName())
if (!function.hasTypeParameterListBeforeFunctionName()) {
appendInn(typeParameterList)
@@ -23,7 +23,7 @@ public interface JetCallableDeclaration extends JetNamedDeclaration, JetTypePara
JetParameterList getValueParameterList();
@Nullable
JetTypeReference getReceiverTypeRef();
JetTypeReference getReceiverTypeReference();
@Nullable
JetTypeReference getTypeReference();
@@ -61,7 +61,7 @@ abstract public class JetFunctionNotStubbed extends JetTypeParameterListOwnerNot
@Override
@Nullable
public JetTypeReference getReceiverTypeRef() {
public JetTypeReference getReceiverTypeReference() {
PsiElement child = getFirstChild();
while (child != null) {
IElementType tt = child.getNode().getElementType();
@@ -78,13 +78,13 @@ abstract public class JetFunctionNotStubbed extends JetTypeParameterListOwnerNot
@Override
@Nullable
public JetTypeReference getTypeReference() {
return TypeRefHelpersPackage.getTypeRef(this);
return TypeRefHelpersPackage.getTypeReference(this);
}
@Nullable
@Override
public JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef) {
return TypeRefHelpersPackage.setTypeRef(this, getValueParameterList(), typeRef);
return TypeRefHelpersPackage.setTypeReference(this, getValueParameterList(), typeRef);
}
@Override
@@ -45,14 +45,14 @@ public class JetFunctionType extends JetElementImplStub<PsiJetPlaceHolderStub<Je
@Override
public List<JetTypeReference> getTypeArgumentsAsTypes() {
ArrayList<JetTypeReference> result = Lists.newArrayList();
JetTypeReference receiverTypeRef = getReceiverTypeRef();
JetTypeReference receiverTypeRef = getReceiverTypeReference();
if (receiverTypeRef != null) {
result.add(receiverTypeRef);
}
for (JetParameter jetParameter : getParameters()) {
result.add(jetParameter.getTypeReference());
}
JetTypeReference returnTypeRef = getReturnTypeRef();
JetTypeReference returnTypeRef = getReturnTypeReference();
if (returnTypeRef != null) {
result.add(returnTypeRef);
}
@@ -76,7 +76,7 @@ public class JetFunctionType extends JetElementImplStub<PsiJetPlaceHolderStub<Je
}
@Nullable
public JetTypeReference getReceiverTypeRef() {
public JetTypeReference getReceiverTypeReference() {
JetFunctionTypeReceiver receiverDeclaration = getStubOrPsiChild(JetStubElementTypes.FUNCTION_TYPE_RECEIVER);
if (receiverDeclaration == null) {
return null;
@@ -85,7 +85,7 @@ public class JetFunctionType extends JetElementImplStub<PsiJetPlaceHolderStub<Je
}
@Nullable
public JetTypeReference getReturnTypeRef() {
public JetTypeReference getReturnTypeReference() {
return getStubOrPsiChild(JetStubElementTypes.TYPE_REFERENCE);
}
}
@@ -38,7 +38,7 @@ public class JetIsExpression extends JetExpressionImpl implements JetOperationEx
}
@Nullable @IfNotParsed
public JetTypeReference getTypeRef() {
public JetTypeReference getTypeReference() {
return (JetTypeReference) findChildByType(JetNodeTypes.TYPE_REFERENCE);
}
@@ -38,13 +38,13 @@ public class JetMultiDeclarationEntry extends JetNamedDeclarationNotStubbed impl
@Override
public JetTypeReference getTypeReference() {
return TypeRefHelpersPackage.getTypeRef(this);
return TypeRefHelpersPackage.getTypeReference(this);
}
@Override
@Nullable
public JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef) {
return TypeRefHelpersPackage.setTypeRef(this, getNameIdentifier(), typeRef);
return TypeRefHelpersPackage.setTypeReference(this, getNameIdentifier(), typeRef);
}
@Nullable
@@ -55,7 +55,7 @@ public class JetMultiDeclarationEntry extends JetNamedDeclarationNotStubbed impl
@Nullable
@Override
public JetTypeReference getReceiverTypeRef() {
public JetTypeReference getReceiverTypeReference() {
return null;
}
@@ -131,7 +131,7 @@ public class JetNamedFunction extends JetTypeParameterListOwnerStub<PsiJetFuncti
@Override
@Nullable
public JetTypeReference getReceiverTypeRef() {
public JetTypeReference getReceiverTypeReference() {
PsiJetFunctionStub stub = getStub();
if (stub != null) {
if (!stub.isExtension()) {
@@ -175,13 +175,13 @@ public class JetNamedFunction extends JetTypeParameterListOwnerStub<PsiJetFuncti
}
return typeReferences.get(returnTypeIndex);
}
return TypeRefHelpersPackage.getTypeRef(this);
return TypeRefHelpersPackage.getTypeReference(this);
}
@Override
@Nullable
public JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef) {
return TypeRefHelpersPackage.setTypeRef(this, getValueParameterList(), typeRef);
return TypeRefHelpersPackage.setTypeReference(this, getValueParameterList(), typeRef);
}
@Override
@@ -49,7 +49,7 @@ public class JetParameter extends JetNamedDeclarationStub<PsiJetParameterStub> {
@Nullable
public JetTypeReference setTypeRef(@Nullable JetTypeReference typeRef) {
return TypeRefHelpersPackage.setTypeRef(this, getNameIdentifier(), typeRef);
return TypeRefHelpersPackage.setTypeReference(this, getNameIdentifier(), typeRef);
}
public boolean hasDefaultValue() {
@@ -86,7 +86,7 @@ public class JetProperty extends JetTypeParameterListOwnerStub<PsiJetPropertyStu
@Override
@Nullable
public JetTypeReference getReceiverTypeRef() {
public JetTypeReference getReceiverTypeReference() {
PsiJetPropertyStub stub = getStub();
if (stub != null) {
if (!stub.hasReceiverTypeRef()) {
@@ -133,13 +133,13 @@ public class JetProperty extends JetTypeParameterListOwnerStub<PsiJetPropertyStu
return typeReferences.get(returnTypeRefPositionInPsi);
}
}
return TypeRefHelpersPackage.getTypeRef(this);
return TypeRefHelpersPackage.getTypeReference(this);
}
@Override
@Nullable
public JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef) {
return TypeRefHelpersPackage.setTypeRef(this, getNameIdentifier(), typeRef);
return TypeRefHelpersPackage.setTypeReference(this, getNameIdentifier(), typeRef);
}
@NotNull
@@ -32,7 +32,7 @@ public class JetWhenConditionIsPattern extends JetWhenCondition {
}
@Nullable @IfNotParsed
public JetTypeReference getTypeRef() {
public JetTypeReference getTypeReference() {
return (JetTypeReference) findChildByType(JetNodeTypes.TYPE_REFERENCE);
}
@@ -26,15 +26,15 @@ import com.intellij.psi.PsiWhiteSpace
import org.jetbrains.jet.lang.psi.JetNamedDeclaration
import com.intellij.psi.PsiErrorElement
fun getTypeRef(declaration: JetDeclaration): JetTypeReference? {
fun getTypeReference(declaration: JetDeclaration): JetTypeReference? {
return declaration.getFirstChild()!!.siblings(forward = true)
.dropWhile { it.getNode()!!.getElementType() != JetTokens.COLON }
.filterIsInstance(javaClass<JetTypeReference>())
.firstOrNull()
}
fun setTypeRef(declaration: JetNamedDeclaration, addAfter: PsiElement?, typeRef: JetTypeReference?): JetTypeReference? {
val oldTypeRef = getTypeRef(declaration)
fun setTypeReference(declaration: JetNamedDeclaration, addAfter: PsiElement?, typeRef: JetTypeReference?): JetTypeReference? {
val oldTypeRef = getTypeReference(declaration)
if (typeRef != null) {
if (oldTypeRef != null) {
return oldTypeRef.replace(typeRef) as JetTypeReference
@@ -193,7 +193,7 @@ public fun PsiElement.isExtensionDeclaration(): Boolean {
else -> null
}
return callable?.getReceiverTypeRef() != null
return callable?.getReceiverTypeReference() != null
}
public fun PsiElement.isObjectLiteral(): Boolean = this is JetObjectDeclaration && isObjectLiteral()
@@ -16,8 +16,6 @@
package org.jetbrains.jet.lang.psi.stubs.elements;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.stubs.IndexSink;
import com.intellij.psi.stubs.StubElement;
import com.intellij.psi.stubs.StubInputStream;
@@ -25,7 +23,6 @@ import com.intellij.psi.stubs.StubOutputStream;
import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.psi.JetDeclaration;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetNamedFunction;
import org.jetbrains.jet.lang.psi.stubs.PsiJetFunctionStub;
@@ -44,7 +41,7 @@ public class JetFunctionElementType extends JetStubElementType<PsiJetFunctionStu
@Override
public PsiJetFunctionStub createStub(@NotNull JetNamedFunction psi, @NotNull StubElement parentStub) {
boolean isTopLevel = psi.getParent() instanceof JetFile;
boolean isExtension = psi.getReceiverTypeRef() != null;
boolean isExtension = psi.getReceiverTypeReference() != null;
FqName fqName = ResolveSessionUtils.safeFqNameForLazyResolve(psi);
boolean hasBlockBody = psi.hasBlockBody();
boolean hasBody = psi.hasBody();
@@ -46,7 +46,7 @@ public class JetPropertyElementType extends JetStubElementType<PsiJetPropertyStu
parentStub, StringRef.fromString(psi.getName()),
psi.isVar(), psi.isTopLevel(), psi.hasDelegate(),
psi.hasDelegateExpression(), psi.hasInitializer(),
psi.getReceiverTypeRef() != null, psi.getTypeReference() != null,
psi.getReceiverTypeReference() != null, psi.getTypeReference() != null,
ResolveSessionUtils.safeFqNameForLazyResolve(psi)
);
}
@@ -475,7 +475,7 @@ public class DeclarationsChecker {
if (!backingFieldRequired) {
trace.report(PROPERTY_INITIALIZER_NO_BACKING_FIELD.on(initializer));
}
else if (property.getReceiverTypeRef() != null) {
else if (property.getReceiverTypeReference() != null) {
trace.report(EXTENSION_PROPERTY_WITH_BACKING_FIELD.on(initializer));
}
}
@@ -317,7 +317,7 @@ public class DescriptorResolver {
resolveGenericBounds(function, functionDescriptor, innerScope, typeParameterDescriptors, trace);
JetType receiverType = null;
JetTypeReference receiverTypeRef = function.getReceiverTypeRef();
JetTypeReference receiverTypeRef = function.getReceiverTypeReference();
if (receiverTypeRef != null) {
JetScope scopeForReceiver =
function.hasTypeParameterListBeforeFunctionName()
@@ -952,7 +952,7 @@ public class DescriptorResolver {
scopeWithTypeParameters = writableScope;
}
JetTypeReference receiverTypeRef = property.getReceiverTypeRef();
JetTypeReference receiverTypeRef = property.getReceiverTypeReference();
if (receiverTypeRef != null) {
receiverType = typeResolver.resolveType(scopeWithTypeParameters, receiverTypeRef, trace, true);
}
@@ -202,7 +202,7 @@ public class TypeResolver {
@Override
public void visitFunctionType(@NotNull JetFunctionType type) {
JetTypeReference receiverTypeRef = type.getReceiverTypeRef();
JetTypeReference receiverTypeRef = type.getReceiverTypeReference();
JetType receiverType = receiverTypeRef == null ? null : resolveType(c.noBareTypes(), receiverTypeRef);
List<JetType> parameterTypes = new ArrayList<JetType>();
@@ -210,7 +210,7 @@ public class TypeResolver {
parameterTypes.add(resolveType(c.noBareTypes(), parameter.getTypeReference()));
}
JetTypeReference returnTypeRef = type.getReturnTypeRef();
JetTypeReference returnTypeRef = type.getReturnTypeReference();
JetType returnType;
if (returnTypeRef != null) {
returnType = resolveType(c.noBareTypes(), returnTypeRef);
@@ -212,7 +212,7 @@ public class ArgumentTypeResolver {
JetFunctionLiteral functionLiteral = expression.getFunctionLiteral();
JetType returnType = resolveTypeRefWithDefault(functionLiteral.getTypeReference(), scope, temporaryTrace, DONT_CARE);
assert returnType != null;
JetType receiverType = resolveTypeRefWithDefault(functionLiteral.getReceiverTypeRef(), scope, temporaryTrace, null);
JetType receiverType = resolveTypeRefWithDefault(functionLiteral.getReceiverTypeReference(), scope, temporaryTrace, null);
return KotlinBuiltIns.getInstance().getFunctionType(Annotations.EMPTY, receiverType, parameterTypes,
returnType);
}
@@ -123,7 +123,7 @@ public class InlineAnalyzerExtension implements FunctionAnalyzerExtension.Analyz
}
ReceiverParameterDescriptor receiverParameter = functionDescriptor.getExtensionReceiverParameter();
if (receiverParameter != null) {
JetTypeReference receiver = function.getReceiverTypeRef();
JetTypeReference receiver = function.getReceiverTypeReference();
assert receiver != null : "Descriptor has a receiver but psi doesn't " + function.getText();
hasInlinable |= checkInlinableParameter(receiverParameter, receiver, functionDescriptor, trace);
}
@@ -130,7 +130,7 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
boolean functionTypeExpected
) {
JetFunctionLiteral functionLiteral = expression.getFunctionLiteral();
JetTypeReference receiverTypeRef = functionLiteral.getReceiverTypeRef();
JetTypeReference receiverTypeRef = functionLiteral.getReceiverTypeReference();
AnonymousFunctionDescriptor functionDescriptor = new AnonymousFunctionDescriptor(
context.scope.getContainingDeclaration(), Annotations.EMPTY, CallableMemberDescriptor.Kind.DECLARATION,
toSourceElement(functionLiteral)
@@ -97,7 +97,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
@Override
public JetTypeInfo visitProperty(@NotNull JetProperty property, ExpressionTypingContext typingContext) {
ExpressionTypingContext context = typingContext.replaceContextDependency(INDEPENDENT).replaceScope(scope);
JetTypeReference receiverTypeRef = property.getReceiverTypeRef();
JetTypeReference receiverTypeRef = property.getReceiverTypeReference();
if (receiverTypeRef != null) {
context.trace.report(LOCAL_EXTENSION_PROPERTY.on(receiverTypeRef));
}
@@ -55,10 +55,10 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
JetTypeInfo typeInfo = facade.safeGetTypeInfo(leftHandSide, context.replaceScope(context.scope));
JetType knownType = typeInfo.getType();
DataFlowInfo dataFlowInfo = typeInfo.getDataFlowInfo();
if (expression.getTypeRef() != null) {
if (expression.getTypeReference() != null) {
DataFlowValue dataFlowValue = DataFlowValueFactory.createDataFlowValue(leftHandSide, knownType,
context.trace.getBindingContext());
DataFlowInfo conditionInfo = checkTypeForIs(context, knownType, expression.getTypeRef(), dataFlowValue).thenInfo;
DataFlowInfo conditionInfo = checkTypeForIs(context, knownType, expression.getTypeReference(), dataFlowValue).thenInfo;
DataFlowInfo newDataFlowInfo = conditionInfo.and(dataFlowInfo);
context.trace.record(BindingContext.DATAFLOW_INFO_AFTER_CONDITION, expression, newDataFlowInfo);
}
@@ -191,8 +191,8 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
if (subjectExpression == null) {
context.trace.report(EXPECTED_CONDITION.on(condition));
}
if (condition.getTypeRef() != null) {
DataFlowInfos result = checkTypeForIs(context, subjectType, condition.getTypeRef(), subjectDataFlowValue);
if (condition.getTypeReference() != null) {
DataFlowInfos result = checkTypeForIs(context, subjectType, condition.getTypeReference(), subjectDataFlowValue);
if (condition.isNegated()) {
newDataFlowInfo.set(new DataFlowInfos(result.elseInfo, result.thenInfo));
}
@@ -107,7 +107,7 @@ public class JetIconProvider extends IconProvider {
}
if (psiElement instanceof JetNamedFunction) {
if (((JetFunction) psiElement).getReceiverTypeRef() != null) {
if (((JetFunction) psiElement).getReceiverTypeReference() != null) {
return JetIcons.EXTENSION_FUNCTION;
}
@@ -78,7 +78,7 @@ public class SimplifyNegatedBinaryExpressionIntention : JetSelfTargetingIntentio
when (expression) {
is JetIsExpression -> {
psiFactory.createExpression(
"${expression.getLeftHandSide().getText() ?: ""} ${invertedOperation.getValue()} ${expression.getTypeRef()?.getText() ?: ""}"
"${expression.getLeftHandSide().getText() ?: ""} ${invertedOperation.getValue()} ${expression.getTypeReference()?.getText() ?: ""}"
)
}
is JetBinaryExpression -> psiFactory.createBinaryExpression(
@@ -43,10 +43,10 @@ public class MemberMatching {
@Nullable
private static JetTypeReference getReceiverType(@NotNull JetNamedDeclaration propertyOrFunction) {
if (propertyOrFunction instanceof JetNamedFunction) {
return ((JetNamedFunction) propertyOrFunction).getReceiverTypeRef();
return ((JetNamedFunction) propertyOrFunction).getReceiverTypeReference();
}
if (propertyOrFunction instanceof JetProperty) {
return ((JetProperty) propertyOrFunction).getReceiverTypeRef();
return ((JetProperty) propertyOrFunction).getReceiverTypeReference();
}
throw new IllegalArgumentException("Neither function nor declaration: " + propertyOrFunction.getClass().getName());
}
@@ -83,7 +83,7 @@ public class MemberMatching {
KotlinBuiltIns builtIns = KotlinBuiltIns.getInstance();
int parameterCount = type.getParameters().size();
if (type.getReceiverTypeRef() == null) {
if (type.getReceiverTypeReference() == null) {
return builtIns.getFunction(parameterCount).getName().asString();
}
else {
@@ -72,7 +72,7 @@ public class JetDeclarationMover extends AbstractJetUpDownMover {
JetTypeParameterList typeParameterList = function.getTypeParameterList();
if (typeParameterList != null) memberSuspects.add(typeParameterList);
JetTypeReference receiverTypeRef = function.getReceiverTypeRef();
JetTypeReference receiverTypeRef = function.getReceiverTypeReference();
if (receiverTypeRef != null) memberSuspects.add(receiverTypeRef);
JetTypeReference returnTypeRef = function.getTypeReference();
@@ -87,7 +87,7 @@ public class JetDeclarationMover extends AbstractJetUpDownMover {
JetTypeParameterList typeParameterList = property.getTypeParameterList();
if (typeParameterList != null) memberSuspects.add(typeParameterList);
JetTypeReference receiverTypeRef = property.getReceiverTypeRef();
JetTypeReference receiverTypeRef = property.getReceiverTypeReference();
if (receiverTypeRef != null) memberSuspects.add(receiverTypeRef);
JetTypeReference returnTypeRef = property.getTypeReference();
@@ -216,8 +216,8 @@ public class JetCompletionContributor : CompletionContributor() {
if (userType != typeRef.getTypeElement()) return false
val parent = typeRef.getParent()
return when (parent) {
is JetNamedFunction -> typeRef == parent.getReceiverTypeRef()
is JetProperty -> typeRef == parent.getReceiverTypeRef()
is JetNamedFunction -> typeRef == parent.getReceiverTypeReference()
is JetProperty -> typeRef == parent.getReceiverTypeReference()
else -> false
}
}
@@ -64,7 +64,7 @@ public object JetUsageTypeProvider : UsageTypeProviderEx {
property.getTypeReference().isAncestor(refExpr) ->
return if (property.isLocal()) UsageType.CLASS_LOCAL_VAR_DECLARATION else JetUsageTypes.NON_LOCAL_PROPERTY_TYPE
property.getReceiverTypeRef().isAncestor(refExpr) ->
property.getReceiverTypeReference().isAncestor(refExpr) ->
return JetUsageTypes.EXTENSION_RECEIVER_TYPE
}
}
@@ -74,7 +74,7 @@ public object JetUsageTypeProvider : UsageTypeProviderEx {
when {
function.getTypeReference().isAncestor(refExpr) ->
return JetUsageTypes.FUNCTION_RETURN_TYPE
function.getReceiverTypeRef().isAncestor(refExpr) ->
function.getReceiverTypeReference().isAncestor(refExpr) ->
return JetUsageTypes.EXTENSION_RECEIVER_TYPE
}
}
@@ -97,7 +97,7 @@ public object JetUsageTypeProvider : UsageTypeProviderEx {
refExpr.getParentByTypeAndBranch(javaClass<JetParameter>()) { getTypeReference() } != null ->
JetUsageTypes.VALUE_PARAMETER_TYPE
refExpr.getParentByTypeAndBranch(javaClass<JetIsExpression>()) { getTypeRef() } != null ->
refExpr.getParentByTypeAndBranch(javaClass<JetIsExpression>()) { getTypeReference() } != null ->
JetUsageTypes.IS
with(refExpr.getParentByTypeAndBranch(javaClass<JetBinaryExpressionWithTypeRHS>()) { getRight() }) {
@@ -99,7 +99,7 @@ public class MakeTypeExplicitInLambdaIntention : JetSelfTargetingIntention<JetFu
val receiverTypeString = DescriptorRenderer.SOURCE_CODE.renderType(expectedReceiverType)
val dot = functionLiteral.addBefore(psiFactory.createDot(), functionLiteral.getValueParameterList())
functionLiteral.addBefore(psiFactory.createType(receiverTypeString), dot)
ShortenReferences.process(functionLiteral.getReceiverTypeRef()!!)
ShortenReferences.process(functionLiteral.getReceiverTypeReference()!!)
}
}
@@ -108,6 +108,6 @@ public class MakeTypeExplicitInLambdaIntention : JetSelfTargetingIntention<JetFu
}
private fun hasImplicitReceiverType(element: JetFunctionLiteralExpression): Boolean {
return element.getFunctionLiteral().getReceiverTypeRef() == null
return element.getFunctionLiteral().getReceiverTypeReference() == null
}
}
@@ -80,7 +80,7 @@ public class MakeTypeImplicitInLambdaIntention : JetSelfTargetingIntention<JetFu
}
private fun hasExplicitReceiverType(element: JetFunctionLiteralExpression): Boolean {
return element.getFunctionLiteral().getReceiverTypeRef() != null
return element.getFunctionLiteral().getReceiverTypeReference() != null
}
private fun hasExplicitParamType(element: JetFunctionLiteralExpression): Boolean {
@@ -37,7 +37,7 @@ fun JetWhenCondition.toExpressionText(subject: JetExpression?): String {
return when (this) {
is JetWhenConditionIsPattern -> {
val op = if (isNegated()) "!is" else "is"
toBinaryExpression(subject, op, getTypeRef())
toBinaryExpression(subject, op, getTypeReference())
}
is JetWhenConditionInRange -> {
toBinaryExpression(subject, getOperationReference()!!.getText()!!, getRangeExpression())
@@ -173,7 +173,7 @@ public fun JetWhenExpression.introduceSubject(): JetWhenExpression {
val conditionExpression = ((condition as JetWhenConditionWithExpression)).getExpression()
when (conditionExpression) {
is JetIsExpression -> {
builder.pattern(conditionExpression.getTypeRef(), conditionExpression.isNegated())
builder.pattern(conditionExpression.getTypeReference(), conditionExpression.isNegated())
}
is JetBinaryExpression -> {
val lhs = conditionExpression.getLeft()
@@ -73,7 +73,7 @@ public class ConvertMemberToExtension extends BaseIntentionAction {
return declaration != null
&& declaration.getParent() instanceof JetClassBody
&& declaration.getParent().getParent() instanceof JetClass
&& declaration.getReceiverTypeRef() == null;
&& declaration.getReceiverTypeReference() == null;
}
private static JetCallableDeclaration getTarget(Editor editor, PsiFile file) {
@@ -62,7 +62,7 @@ public class JetFunctionPresenter implements ItemPresentationProvider<JetNamedFu
public String getLocationString() {
FqName name = function.getFqName();
if (name != null) {
JetTypeReference receiverTypeRef = function.getReceiverTypeRef();
JetTypeReference receiverTypeRef = function.getReceiverTypeReference();
String extensionLocation = receiverTypeRef != null ? "for " + receiverTypeRef.getText() + " " : "";
return String.format("(%sin %s)", extensionLocation, name.parent());
}
@@ -69,7 +69,7 @@ public class JetDeclarationTreeNode extends AbstractPsiBasedNode<JetDeclaration>
}
else if (declaration instanceof JetFunction) {
JetFunction function = (JetFunction) declaration;
JetTypeReference receiverTypeRef = function.getReceiverTypeRef();
JetTypeReference receiverTypeRef = function.getReceiverTypeReference();
if (receiverTypeRef != null) {
text = receiverTypeRef.getText() + "." + text;
}
@@ -372,7 +372,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
val receiverTypeRef = JetPsiFactory(declaration).createType(receiverTypeCandidate!!.theType.renderLong(typeParameterNameMap))
replaceWithLongerName(receiverTypeRef, receiverTypeCandidate.theType)
val funcReceiverTypeRef = declaration.getReceiverTypeRef()
val funcReceiverTypeRef = declaration.getReceiverTypeReference()
if (funcReceiverTypeRef != null) {
typeRefsToShorten.add(funcReceiverTypeRef)
}
@@ -83,7 +83,7 @@ public class KotlinInlineValHandler extends InlineActionHandler {
return false;
}
JetProperty property = (JetProperty) element;
return !property.isVar() && property.getGetter() == null && property.getReceiverTypeRef() == null;
return !property.isVar() && property.getGetter() == null && property.getReceiverTypeReference() == null;
}
@Override
@@ -52,7 +52,7 @@ public final class PatternTranslator extends AbstractTranslator {
@NotNull
public JsExpression translateIsExpression(@NotNull JetIsExpression expression) {
JsExpression left = Translation.translateAsExpression(expression.getLeftHandSide(), context());
JetTypeReference typeReference = expression.getTypeRef();
JetTypeReference typeReference = expression.getTypeReference();
assert typeReference != null;
JsExpression result = translateIsCheck(left, typeReference);
if (expression.isNegated()) {
@@ -175,7 +175,7 @@ public final class WhenTranslator extends AbstractTranslator {
JsExpression expressionToMatch = getExpressionToMatch();
assert expressionToMatch != null : "An is-check is not allowed in when() without subject.";
JetTypeReference typeReference = conditionIsPattern.getTypeRef();
JetTypeReference typeReference = conditionIsPattern.getTypeReference();
assert typeReference != null : "An is-check must have a type reference.";
return Translation.patternTranslator(context).translateIsCheck(expressionToMatch, typeReference);