JET-124 Sometimes local variables are not resolved in the callee position
This commit is contained in:
@@ -36,7 +36,6 @@ public class WritableScopeImpl extends WritableScopeWithImports {
|
||||
@Nullable
|
||||
private JetType thisType;
|
||||
|
||||
private boolean variablesAsFunctionsAdded;
|
||||
private List<VariableDescriptor> variableDescriptors;
|
||||
|
||||
public WritableScopeImpl(@NotNull JetScope scope, @NotNull DeclarationDescriptor owner, @NotNull ErrorHandler errorHandler) {
|
||||
@@ -243,9 +242,9 @@ public class WritableScopeImpl extends WritableScopeWithImports {
|
||||
}
|
||||
|
||||
private void addVariablesAsFunctions() {
|
||||
if (variablesAsFunctionsAdded) return;
|
||||
variablesAsFunctionsAdded = true;
|
||||
for (VariableDescriptor variableDescriptor : getVariableDescriptors()) {
|
||||
List<VariableDescriptor> variableDescriptors = getVariableDescriptors();
|
||||
this.variableDescriptors = null;
|
||||
for (VariableDescriptor variableDescriptor : variableDescriptors) {
|
||||
JetType outType = variableDescriptor.getOutType();
|
||||
if (outType != null && JetStandardClasses.isFunctionType(outType)) {
|
||||
addFunctionDescriptor(VariableAsFunctionDescriptor.create(variableDescriptor));
|
||||
|
||||
@@ -2482,7 +2482,6 @@ public class JetTypeInferrer {
|
||||
|
||||
@Override
|
||||
public void visitProperty(JetProperty property) {
|
||||
|
||||
JetTypeReference receiverTypeRef = property.getReceiverTypeRef();
|
||||
if (receiverTypeRef != null) {
|
||||
context.trace.getErrorHandler().genericError(receiverTypeRef.getNode(), "Local receiver-properties are not allowed");
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fun foo1() : {(Int) : Int}
|
||||
|
||||
fun foo() {
|
||||
val h : {(Int) : Int} = foo1();
|
||||
h(1)
|
||||
val m : {(Int) : Int} = {(a : Int) => 1}//foo1()
|
||||
m(1)
|
||||
}
|
||||
Reference in New Issue
Block a user