diff --git a/idea/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java b/idea/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java index 7261d33c99c..af9f99f1266 100644 --- a/idea/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java +++ b/idea/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java @@ -176,7 +176,7 @@ public class JetControlFlowProcessor { builder.writeNode(expression, left); } else { - throw new UnsupportedOperationException("Assignments to " + left + " are not supported yet"); // TODO + builder.unsupported(expression); } } else { diff --git a/idea/src/org/jetbrains/jet/lang/resolve/TopDownAnalyzer.java b/idea/src/org/jetbrains/jet/lang/resolve/TopDownAnalyzer.java index 91854940436..a7dea9621c6 100644 --- a/idea/src/org/jetbrains/jet/lang/resolve/TopDownAnalyzer.java +++ b/idea/src/org/jetbrains/jet/lang/resolve/TopDownAnalyzer.java @@ -270,6 +270,7 @@ public class TopDownAnalyzer { for (ValueParameterDescriptor valueParameterDescriptor : descriptor.getUnsubstitutedValueParameters()) { parameterScope.addPropertyDescriptor(valueParameterDescriptor); } + parameterScope.addLabeledDeclaration(descriptor); assert declaration instanceof JetFunction || declaration instanceof JetConstructor; JetDeclarationWithBody declarationWithBody = (JetDeclarationWithBody) declaration; @@ -283,9 +284,11 @@ public class TopDownAnalyzer { controlFlowDataTrace.close(); boolean preferBlock = true; + FunctionDescriptorImpl functionDescriptorImpl = null; if (declaration instanceof JetFunction) { JetFunction jetFunction = (JetFunction) declaration; preferBlock = jetFunction.hasBlockBody(); + functionDescriptorImpl = (FunctionDescriptorImpl) descriptor; } JetType returnType = resolveExpression(parameterScope, bodyExpression, preferBlock, controlFlowDataTrace); @@ -304,7 +307,7 @@ public class TopDownAnalyzer { if (safeReturnType == null) { safeReturnType = ErrorUtils.createErrorType("Unable to infer body type"); } - ((FunctionDescriptorImpl) descriptor).setUnsubstitutedReturnType(safeReturnType); + functionDescriptorImpl.setUnsubstitutedReturnType(safeReturnType); } } } diff --git a/idea/src/org/jetbrains/jet/lang/types/FunctionDescriptorImpl.java b/idea/src/org/jetbrains/jet/lang/types/FunctionDescriptorImpl.java index 2f9dc16a6bd..723f9e09ab6 100644 --- a/idea/src/org/jetbrains/jet/lang/types/FunctionDescriptorImpl.java +++ b/idea/src/org/jetbrains/jet/lang/types/FunctionDescriptorImpl.java @@ -75,4 +75,5 @@ public class FunctionDescriptorImpl extends DeclarationDescriptorImpl implements public R accept(DeclarationDescriptorVisitor visitor, D data) { return visitor.visitFunctionDescriptor(this, data); } + } diff --git a/idea/testData/checker/BinaryCallsOnNullableValues.jet b/idea/testData/checker/BinaryCallsOnNullableValues.jet index 8c7cda9e167..fa3f397e598 100644 --- a/idea/testData/checker/BinaryCallsOnNullableValues.jet +++ b/idea/testData/checker/BinaryCallsOnNullableValues.jet @@ -10,7 +10,7 @@ class C { fun equals(a : Any?) : Int } -fun f(): Int { +fun f(): Unit { var x: Int? = 1 x = 1 x + 1 diff --git a/idea/testData/checker/QualifiedThis.jet b/idea/testData/checker/QualifiedThis.jet index 7ee958a4a17..1da9fc873df 100644 --- a/idea/testData/checker/QualifiedThis.jet +++ b/idea/testData/checker/QualifiedThis.jet @@ -5,7 +5,7 @@ class Dup { } class A { - fun foo() { + fun foo() : Unit { this@A this@a this @@ -16,7 +16,7 @@ class A { val z = foo() } -fun foo() { +fun foo() : Unit { this this@a }