Tests fixed
This commit is contained in:
@@ -176,7 +176,7 @@ public class JetControlFlowProcessor {
|
|||||||
builder.writeNode(expression, left);
|
builder.writeNode(expression, left);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new UnsupportedOperationException("Assignments to " + left + " are not supported yet"); // TODO
|
builder.unsupported(expression);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -270,6 +270,7 @@ public class TopDownAnalyzer {
|
|||||||
for (ValueParameterDescriptor valueParameterDescriptor : descriptor.getUnsubstitutedValueParameters()) {
|
for (ValueParameterDescriptor valueParameterDescriptor : descriptor.getUnsubstitutedValueParameters()) {
|
||||||
parameterScope.addPropertyDescriptor(valueParameterDescriptor);
|
parameterScope.addPropertyDescriptor(valueParameterDescriptor);
|
||||||
}
|
}
|
||||||
|
parameterScope.addLabeledDeclaration(descriptor);
|
||||||
|
|
||||||
assert declaration instanceof JetFunction || declaration instanceof JetConstructor;
|
assert declaration instanceof JetFunction || declaration instanceof JetConstructor;
|
||||||
JetDeclarationWithBody declarationWithBody = (JetDeclarationWithBody) declaration;
|
JetDeclarationWithBody declarationWithBody = (JetDeclarationWithBody) declaration;
|
||||||
@@ -283,9 +284,11 @@ public class TopDownAnalyzer {
|
|||||||
controlFlowDataTrace.close();
|
controlFlowDataTrace.close();
|
||||||
|
|
||||||
boolean preferBlock = true;
|
boolean preferBlock = true;
|
||||||
|
FunctionDescriptorImpl functionDescriptorImpl = null;
|
||||||
if (declaration instanceof JetFunction) {
|
if (declaration instanceof JetFunction) {
|
||||||
JetFunction jetFunction = (JetFunction) declaration;
|
JetFunction jetFunction = (JetFunction) declaration;
|
||||||
preferBlock = jetFunction.hasBlockBody();
|
preferBlock = jetFunction.hasBlockBody();
|
||||||
|
functionDescriptorImpl = (FunctionDescriptorImpl) descriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
JetType returnType = resolveExpression(parameterScope, bodyExpression, preferBlock, controlFlowDataTrace);
|
JetType returnType = resolveExpression(parameterScope, bodyExpression, preferBlock, controlFlowDataTrace);
|
||||||
@@ -304,7 +307,7 @@ public class TopDownAnalyzer {
|
|||||||
if (safeReturnType == null) {
|
if (safeReturnType == null) {
|
||||||
safeReturnType = ErrorUtils.createErrorType("Unable to infer body type");
|
safeReturnType = ErrorUtils.createErrorType("Unable to infer body type");
|
||||||
}
|
}
|
||||||
((FunctionDescriptorImpl) descriptor).setUnsubstitutedReturnType(safeReturnType);
|
functionDescriptorImpl.setUnsubstitutedReturnType(safeReturnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,4 +75,5 @@ public class FunctionDescriptorImpl extends DeclarationDescriptorImpl implements
|
|||||||
public <R, D> R accept(DeclarationDescriptorVisitor<R, D> visitor, D data) {
|
public <R, D> R accept(DeclarationDescriptorVisitor<R, D> visitor, D data) {
|
||||||
return visitor.visitFunctionDescriptor(this, data);
|
return visitor.visitFunctionDescriptor(this, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class C {
|
|||||||
fun equals(a : Any?) : Int
|
fun equals(a : Any?) : Int
|
||||||
}
|
}
|
||||||
|
|
||||||
fun f(): Int {
|
fun f(): Unit {
|
||||||
var x: Int? = 1
|
var x: Int? = 1
|
||||||
x = 1
|
x = 1
|
||||||
x <error>+</error> 1
|
x <error>+</error> 1
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class Dup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
fun foo() {
|
fun foo() : Unit {
|
||||||
this@A
|
this@A
|
||||||
this<error>@a</error>
|
this<error>@a</error>
|
||||||
this
|
this
|
||||||
@@ -16,7 +16,7 @@ class A {
|
|||||||
val z = foo()
|
val z = foo()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo() {
|
fun foo() : Unit {
|
||||||
<error>this</error>
|
<error>this</error>
|
||||||
this<error>@a</error>
|
this<error>@a</error>
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user