JetVariableDeclaration made JetCallableDeclaration and renamed getTypeRef/setTypeRef, getReturnTypeRef/setReturnTypeRef to getTypeReference/setTypeReference
This commit is contained in:
+2
-2
@@ -53,7 +53,7 @@ public class AlternativeFieldSignatureData extends ElementAlternativeSignatureDa
|
||||
try {
|
||||
checkForSyntaxErrors(altPropertyDeclaration);
|
||||
checkFieldAnnotation(altPropertyDeclaration, field, isVar);
|
||||
altReturnType = computeReturnType(originalReturnType, altPropertyDeclaration.getTypeRef(),
|
||||
altReturnType = computeReturnType(originalReturnType, altPropertyDeclaration.getTypeReference(),
|
||||
new HashMap<TypeParameterDescriptor, TypeParameterDescriptorImpl>());
|
||||
}
|
||||
catch (AlternativeSignatureMismatchException e) {
|
||||
@@ -73,7 +73,7 @@ public class AlternativeFieldSignatureData extends ElementAlternativeSignatureDa
|
||||
field.getName().asString(), altProperty.getName());
|
||||
}
|
||||
|
||||
if (altProperty.getTypeRef() == null) {
|
||||
if (altProperty.getTypeReference() == null) {
|
||||
throw new AlternativeSignatureMismatchException("Field annotation for shouldn't have type reference");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ public class AlternativeMethodSignatureData extends ElementAlternativeSignatureD
|
||||
computeValueParameters(valueParameters);
|
||||
|
||||
if (originalReturnType != null) {
|
||||
altReturnType = computeReturnType(originalReturnType, altFunDeclaration.getReturnTypeRef(), originalToAltTypeParameters);
|
||||
altReturnType = computeReturnType(originalReturnType, altFunDeclaration.getTypeReference(), originalToAltTypeParameters);
|
||||
}
|
||||
|
||||
if (hasSuperMethods) {
|
||||
|
||||
@@ -72,12 +72,12 @@ public class PositioningStrategies {
|
||||
PsiElement nameIdentifierOrPlaceholder = null;
|
||||
if (declaration instanceof JetNamedFunction) {
|
||||
JetFunction function = (JetNamedFunction) declaration;
|
||||
returnTypeRef = function.getReturnTypeRef();
|
||||
returnTypeRef = function.getTypeReference();
|
||||
nameIdentifierOrPlaceholder = function.getNameIdentifier();
|
||||
}
|
||||
else if (declaration instanceof JetProperty) {
|
||||
JetProperty property = (JetProperty) declaration;
|
||||
returnTypeRef = property.getTypeRef();
|
||||
returnTypeRef = property.getTypeReference();
|
||||
nameIdentifierOrPlaceholder = property.getNameIdentifier();
|
||||
}
|
||||
else if (declaration instanceof JetPropertyAccessor) {
|
||||
@@ -148,7 +148,7 @@ public class PositioningStrategies {
|
||||
JetNamedFunction function = (JetNamedFunction)element;
|
||||
PsiElement endOfSignatureElement;
|
||||
JetParameterList valueParameterList = function.getValueParameterList();
|
||||
JetElement returnTypeRef = function.getReturnTypeRef();
|
||||
JetElement returnTypeRef = function.getTypeReference();
|
||||
PsiElement nameIdentifier = function.getNameIdentifier();
|
||||
if (returnTypeRef != null) {
|
||||
endOfSignatureElement = returnTypeRef;
|
||||
@@ -167,7 +167,7 @@ public class PositioningStrategies {
|
||||
else if (element instanceof JetProperty) {
|
||||
JetProperty property = (JetProperty) element;
|
||||
PsiElement endOfSignatureElement;
|
||||
JetTypeReference propertyTypeRef = property.getTypeRef();
|
||||
JetTypeReference propertyTypeRef = property.getTypeReference();
|
||||
PsiElement nameIdentifier = property.getNameIdentifier();
|
||||
if (propertyTypeRef != null) {
|
||||
endOfSignatureElement = propertyTypeRef;
|
||||
|
||||
@@ -266,7 +266,7 @@ private object DebugTextBuildingVisitor : JetVisitor<String, Unit>() {
|
||||
appendInn(typeParameterList)
|
||||
}
|
||||
appendInn(function.getValueParameterList())
|
||||
appendInn(function.getReturnTypeRef(), prefix = ": ")
|
||||
appendInn(function.getTypeReference(), prefix = ": ")
|
||||
appendInn(function.getTypeConstraintList(), prefix = " ")
|
||||
}
|
||||
}
|
||||
@@ -302,7 +302,7 @@ private object DebugTextBuildingVisitor : JetVisitor<String, Unit>() {
|
||||
appendInn(property.getModifierList(), suffix = " ")
|
||||
append(if (property.isVar()) "var " else "val ")
|
||||
appendInn(property.getNameAsName())
|
||||
appendInn(property.getTypeRef(), prefix = ": ")
|
||||
appendInn(property.getTypeReference(), prefix = ": ")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ public interface JetCallableDeclaration extends JetNamedDeclaration, JetTypePara
|
||||
JetTypeReference getReceiverTypeRef();
|
||||
|
||||
@Nullable
|
||||
JetTypeReference getReturnTypeRef();
|
||||
JetTypeReference getTypeReference();
|
||||
|
||||
@Nullable
|
||||
JetTypeReference setReturnTypeRef(@Nullable JetTypeReference typeRef);
|
||||
JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class JetFunctionLiteralExpression extends JetExpressionImpl {
|
||||
}
|
||||
|
||||
public boolean hasDeclaredReturnType() {
|
||||
return getFunctionLiteral().getReturnTypeRef() != null;
|
||||
return getFunctionLiteral().getTypeReference() != null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -56,7 +56,7 @@ abstract public class JetFunctionNotStubbed extends JetTypeParameterListOwnerNot
|
||||
|
||||
@Override
|
||||
public boolean hasDeclaredReturnType() {
|
||||
return getReturnTypeRef() != null;
|
||||
return getTypeReference() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,13 +77,13 @@ abstract public class JetFunctionNotStubbed extends JetTypeParameterListOwnerNot
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JetTypeReference getReturnTypeRef() {
|
||||
public JetTypeReference getTypeReference() {
|
||||
return TypeRefHelpersPackage.getTypeRef(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JetTypeReference setReturnTypeRef(@Nullable JetTypeReference typeRef) {
|
||||
public JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef) {
|
||||
return TypeRefHelpersPackage.setTypeRef(this, getValueParameterList(), typeRef);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public final class JetModifiableBlockHelper {
|
||||
}
|
||||
else if (declaration instanceof JetProperty) {
|
||||
JetProperty property = (JetProperty) declaration;
|
||||
if (property.getTypeRef() != null) {
|
||||
if (property.getTypeReference() != null) {
|
||||
return takePartInDeclarationTypeInference(property);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public final class JetModifiableBlockHelper {
|
||||
}
|
||||
else if (declaration instanceof JetProperty) {
|
||||
JetProperty property = (JetProperty) declaration;
|
||||
if (property.getTypeRef() == null) {
|
||||
if (property.getTypeReference() == null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ import org.jetbrains.jet.lang.psi.typeRefHelpers.TypeRefHelpersPackage;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.jet.lexer.JetTokens.VAL_KEYWORD;
|
||||
import static org.jetbrains.jet.lexer.JetTokens.VAR_KEYWORD;
|
||||
|
||||
@@ -34,16 +37,40 @@ public class JetMultiDeclarationEntry extends JetNamedDeclarationNotStubbed impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetTypeReference getTypeRef() {
|
||||
public JetTypeReference getTypeReference() {
|
||||
return TypeRefHelpersPackage.getTypeRef(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JetTypeReference setTypeRef(@Nullable JetTypeReference typeRef) {
|
||||
public JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef) {
|
||||
return TypeRefHelpersPackage.setTypeRef(this, getNameIdentifier(), typeRef);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JetParameterList getValueParameterList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JetTypeReference getReceiverTypeRef() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<JetTypeConstraint> getTypeConstraints() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<JetTypeParameter> getTypeParameters() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, D> R accept(@NotNull JetVisitor<R, D> visitor, D data) {
|
||||
return visitor.visitMultiDeclarationEntry(this, data);
|
||||
|
||||
@@ -126,7 +126,7 @@ public class JetNamedFunction extends JetTypeParameterListOwnerStub<PsiJetFuncti
|
||||
|
||||
@Override
|
||||
public boolean hasDeclaredReturnType() {
|
||||
return getReturnTypeRef() != null;
|
||||
return getTypeReference() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -165,7 +165,7 @@ public class JetNamedFunction extends JetTypeParameterListOwnerStub<PsiJetFuncti
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JetTypeReference getReturnTypeRef() {
|
||||
public JetTypeReference getTypeReference() {
|
||||
PsiJetFunctionStub stub = getStub();
|
||||
if (stub != null) {
|
||||
List<JetTypeReference> typeReferences = getStubOrPsiChildrenAsList(JetStubElementTypes.TYPE_REFERENCE);
|
||||
@@ -180,7 +180,7 @@ public class JetNamedFunction extends JetTypeParameterListOwnerStub<PsiJetFuncti
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JetTypeReference setReturnTypeRef(@Nullable JetTypeReference typeRef) {
|
||||
public JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef) {
|
||||
return TypeRefHelpersPackage.setTypeRef(this, getValueParameterList(), typeRef);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,7 @@ import java.util.List;
|
||||
import static org.jetbrains.jet.JetNodeTypes.PROPERTY_DELEGATE;
|
||||
import static org.jetbrains.jet.lexer.JetTokens.*;
|
||||
|
||||
public class JetProperty extends JetTypeParameterListOwnerStub<PsiJetPropertyStub> implements JetVariableDeclaration,
|
||||
JetCallableDeclaration {
|
||||
public class JetProperty extends JetTypeParameterListOwnerStub<PsiJetPropertyStub> implements JetVariableDeclaration {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(JetProperty.class);
|
||||
|
||||
@@ -116,21 +115,9 @@ public class JetProperty extends JetTypeParameterListOwnerStub<PsiJetPropertyStu
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JetTypeReference getReturnTypeRef() {
|
||||
return getTypeRef();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JetTypeReference setReturnTypeRef(@Nullable JetTypeReference typeRef) {
|
||||
return setTypeRef(typeRef);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JetTypeReference getTypeRef() {
|
||||
public JetTypeReference getTypeReference() {
|
||||
PsiJetPropertyStub stub = getStub();
|
||||
if (stub != null) {
|
||||
if (!stub.hasReturnTypeRef()) {
|
||||
@@ -151,7 +138,7 @@ public class JetProperty extends JetTypeParameterListOwnerStub<PsiJetPropertyStu
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JetTypeReference setTypeRef(@Nullable JetTypeReference typeRef) {
|
||||
public JetTypeReference setTypeReference(@Nullable JetTypeReference typeRef) {
|
||||
return TypeRefHelpersPackage.setTypeRef(this, getNameIdentifier(), typeRef);
|
||||
}
|
||||
|
||||
@@ -242,7 +229,7 @@ public class JetProperty extends JetTypeParameterListOwnerStub<PsiJetPropertyStu
|
||||
}
|
||||
else {
|
||||
if (initializer != null) {
|
||||
PsiElement addAfter = getTypeRef();
|
||||
PsiElement addAfter = getTypeReference();
|
||||
if (addAfter == null) {
|
||||
addAfter = getNameIdentifier();
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class JetPsiFactory(private val project: Project) {
|
||||
}
|
||||
|
||||
public fun createType(`type`: String): JetTypeReference {
|
||||
return createProperty("val x : $`type`").getTypeRef()!!
|
||||
return createProperty("val x : $`type`").getTypeReference()!!
|
||||
}
|
||||
|
||||
public fun createStar(): PsiElement {
|
||||
|
||||
@@ -19,15 +19,9 @@ package org.jetbrains.jet.lang.psi;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface JetVariableDeclaration extends JetDeclaration, JetWithExpressionInitializer, JetNamedDeclaration {
|
||||
public interface JetVariableDeclaration extends JetCallableDeclaration, JetWithExpressionInitializer {
|
||||
boolean isVar();
|
||||
|
||||
@Nullable
|
||||
ASTNode getValOrVarNode();
|
||||
|
||||
@Nullable
|
||||
JetTypeReference getTypeRef();
|
||||
|
||||
@Nullable
|
||||
JetTypeReference setTypeRef(@Nullable JetTypeReference typeRef);
|
||||
}
|
||||
|
||||
+1
-4
@@ -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.JetProperty;
|
||||
import org.jetbrains.jet.lang.psi.stubs.PsiJetPropertyStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetPropertyStubImpl;
|
||||
@@ -49,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.getReturnTypeRef() != null,
|
||||
psi.getReceiverTypeRef() != null, psi.getTypeReference() != null,
|
||||
ResolveSessionUtils.safeFqNameForLazyResolve(psi)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -562,7 +562,7 @@ public class BodyResolver {
|
||||
) {
|
||||
JetScope propertyDeclarationInnerScope = JetScopeUtils.getPropertyDeclarationInnerScopeForInitializer(
|
||||
scope, propertyDescriptor.getTypeParameters(), NO_RECEIVER_PARAMETER, trace);
|
||||
JetType expectedTypeForInitializer = property.getTypeRef() != null ? propertyDescriptor.getType() : NO_EXPECTED_TYPE;
|
||||
JetType expectedTypeForInitializer = property.getTypeReference() != null ? propertyDescriptor.getType() : NO_EXPECTED_TYPE;
|
||||
CompileTimeConstant<?> compileTimeInitializer = propertyDescriptor.getCompileTimeInitializer();
|
||||
if (compileTimeInitializer == null) {
|
||||
expressionTypingServices.getType(propertyDeclarationInnerScope, initializer, expectedTypeForInitializer, c.getOuterDataFlowInfo(), trace);
|
||||
|
||||
@@ -362,12 +362,12 @@ public class DeclarationsChecker {
|
||||
private void checkDeclaredTypeInPublicMember(JetNamedDeclaration member, CallableMemberDescriptor memberDescriptor) {
|
||||
boolean hasDeferredType;
|
||||
if (member instanceof JetProperty) {
|
||||
hasDeferredType = ((JetProperty) member).getTypeRef() == null && DescriptorResolver.hasBody((JetProperty) member);
|
||||
hasDeferredType = ((JetProperty) member).getTypeReference() == null && DescriptorResolver.hasBody((JetProperty) member);
|
||||
}
|
||||
else {
|
||||
assert member instanceof JetFunction;
|
||||
JetFunction function = (JetFunction) member;
|
||||
hasDeferredType = function.getReturnTypeRef() == null && function.hasBody() && !function.hasBlockBody();
|
||||
hasDeferredType = function.getTypeReference() == null && function.hasBody() && !function.hasBlockBody();
|
||||
}
|
||||
if ((memberDescriptor.getVisibility().isPublicAPI()) && memberDescriptor.getOverriddenDescriptors().size() == 0 && hasDeferredType) {
|
||||
trace.report(PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE.on(member));
|
||||
@@ -425,7 +425,7 @@ public class DeclarationsChecker {
|
||||
(setter != null && setter.hasBody());
|
||||
|
||||
if (propertyDescriptor.getModality() == Modality.ABSTRACT) {
|
||||
if (!property.hasDelegateExpressionOrInitializer() && property.getTypeRef() == null) {
|
||||
if (!property.hasDelegateExpressionOrInitializer() && property.getTypeReference() == null) {
|
||||
trace.report(PROPERTY_WITH_NO_TYPE_NO_INITIALIZER.on(property));
|
||||
}
|
||||
return;
|
||||
@@ -454,7 +454,7 @@ public class DeclarationsChecker {
|
||||
trace.report(MUST_BE_INITIALIZED_OR_BE_ABSTRACT.on(property));
|
||||
}
|
||||
}
|
||||
if (!error && property.getTypeRef() == null) {
|
||||
if (!error && property.getTypeReference() == null) {
|
||||
trace.report(PROPERTY_WITH_NO_TYPE_NO_INITIALIZER.on(property));
|
||||
}
|
||||
if (inTrait && property.hasModifier(JetTokens.FINAL_KEYWORD) && backingFieldRequired) {
|
||||
|
||||
@@ -302,7 +302,7 @@ public class DelegatedPropertyResolver {
|
||||
@NotNull final JetScope accessorScope,
|
||||
@NotNull final BindingTrace trace
|
||||
) {
|
||||
final JetType expectedType = property.getTypeRef() != null ? propertyDescriptor.getType() : NO_EXPECTED_TYPE;
|
||||
final JetType expectedType = property.getTypeReference() != null ? propertyDescriptor.getType() : NO_EXPECTED_TYPE;
|
||||
return new ConstraintSystemCompleter() {
|
||||
@Override
|
||||
public void completeConstraintSystem(
|
||||
|
||||
@@ -331,7 +331,7 @@ public class DescriptorResolver {
|
||||
|
||||
innerScope.changeLockLevel(WritableScope.LockLevel.READING);
|
||||
|
||||
JetTypeReference returnTypeRef = function.getReturnTypeRef();
|
||||
JetTypeReference returnTypeRef = function.getTypeReference();
|
||||
JetType returnType;
|
||||
if (returnTypeRef != null) {
|
||||
returnType = typeResolver.resolveType(innerScope, returnTypeRef, trace, true);
|
||||
@@ -1005,7 +1005,7 @@ public class DescriptorResolver {
|
||||
boolean notLocal,
|
||||
@NotNull final BindingTrace trace
|
||||
) {
|
||||
JetTypeReference propertyTypeRef = variable.getTypeRef();
|
||||
JetTypeReference propertyTypeRef = variable.getTypeReference();
|
||||
|
||||
boolean hasDelegate = variable instanceof JetProperty && ((JetProperty) variable).hasDelegateExpression();
|
||||
if (propertyTypeRef == null) {
|
||||
|
||||
+1
-2
@@ -41,7 +41,6 @@ import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
import javax.inject.Inject;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContextUtils.getRecordedTypeInfo;
|
||||
import static org.jetbrains.jet.lang.resolve.calls.CallResolverUtil.ResolveArgumentsMode;
|
||||
@@ -211,7 +210,7 @@ public class ArgumentTypeResolver {
|
||||
parameterTypes.add(resolveTypeRefWithDefault(parameter.getTypeReference(), scope, temporaryTrace, DONT_CARE));
|
||||
}
|
||||
JetFunctionLiteral functionLiteral = expression.getFunctionLiteral();
|
||||
JetType returnType = resolveTypeRefWithDefault(functionLiteral.getReturnTypeRef(), scope, temporaryTrace, DONT_CARE);
|
||||
JetType returnType = resolveTypeRefWithDefault(functionLiteral.getTypeReference(), scope, temporaryTrace, DONT_CARE);
|
||||
assert returnType != null;
|
||||
JetType receiverType = resolveTypeRefWithDefault(functionLiteral.getReceiverTypeRef(), scope, temporaryTrace, null);
|
||||
return KotlinBuiltIns.getInstance().getFunctionType(Annotations.EMPTY, receiverType, parameterTypes,
|
||||
|
||||
@@ -48,6 +48,6 @@ public fun shouldBeScriptClassMember(declaration: JetDeclaration): Boolean {
|
||||
// To avoid the necessity to always analyze the whole body of a script even if just its class descriptor is needed
|
||||
// we only add those vals, vars and funs that have explicitly specified return types
|
||||
// (or implicit Unit for function with block body)
|
||||
return declaration is JetCallableDeclaration && declaration.getReturnTypeRef() != null
|
||||
return declaration is JetCallableDeclaration && declaration.getTypeReference() != null
|
||||
|| declaration is JetNamedFunction && declaration.hasBlockBody()
|
||||
}
|
||||
|
||||
+1
-1
@@ -275,7 +275,7 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
|
||||
assert bodyExpression != null;
|
||||
|
||||
JetScope functionInnerScope = FunctionDescriptorUtil.getFunctionInnerScope(context.scope, functionDescriptor, context.trace);
|
||||
JetTypeReference returnTypeRef = functionLiteral.getReturnTypeRef();
|
||||
JetTypeReference returnTypeRef = functionLiteral.getTypeReference();
|
||||
JetType declaredReturnType = null;
|
||||
if (returnTypeRef != null) {
|
||||
declaredReturnType = components.expressionTypingServices.getTypeResolver().resolveType(context.scope, returnTypeRef, context.trace, true);
|
||||
|
||||
+1
-1
@@ -517,7 +517,7 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
|
||||
private static JetType getFunctionExpectedReturnType(@NotNull FunctionDescriptor descriptor, @NotNull JetElement function) {
|
||||
JetType expectedType;
|
||||
if (function instanceof JetFunction) {
|
||||
if (((JetFunction) function).getReturnTypeRef() != null || ((JetFunction) function).hasBlockBody()) {
|
||||
if (((JetFunction) function).getTypeReference() != null || ((JetFunction) function).hasBlockBody()) {
|
||||
expectedType = descriptor.getReturnType();
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -391,7 +391,7 @@ public class ExpressionTypingUtils {
|
||||
|
||||
@NotNull
|
||||
private JetType getExpectedTypeForComponent(ExpressionTypingContext context, JetMultiDeclarationEntry entry) {
|
||||
JetTypeReference entryTypeRef = entry.getTypeRef();
|
||||
JetTypeReference entryTypeRef = entry.getTypeReference();
|
||||
if (entryTypeRef != null) {
|
||||
return expressionTypingServices.getTypeResolver().resolveType(context.scope, entryTypeRef, context.trace, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user