From b621f58a838853ce9bfdf99a412988ab20141592 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Tue, 5 Apr 2011 16:16:23 +0400 Subject: [PATCH] Some tests for return types --- .../jet/lang/cfg/JetControlFlowProcessor.java | 8 ++++++++ idea/testData/checker/FunctionReturnTypes.jet | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 idea/testData/checker/FunctionReturnTypes.jet diff --git a/idea/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java b/idea/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java index 35137f65d30..b710afa01ca 100644 --- a/idea/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java +++ b/idea/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java @@ -438,6 +438,14 @@ public class JetControlFlowProcessor { } } + @Override + public void visitTupleExpression(JetTupleExpression expression) { + for (JetExpression entry : expression.getEntries()) { + value(entry, false); + } + builder.readNode(expression); + } + @Override public void visitTypeProjection(JetTypeProjection typeProjection) { // TODO : Support Type Arguments. Class object may be initialized at this point"); diff --git a/idea/testData/checker/FunctionReturnTypes.jet b/idea/testData/checker/FunctionReturnTypes.jet new file mode 100644 index 00000000000..5aa66116cfe --- /dev/null +++ b/idea/testData/checker/FunctionReturnTypes.jet @@ -0,0 +1,18 @@ +fun none() + +fun unitEmptyInfer() {} +fun unitEmpty() : Unit {} +fun unitEmptyReturn() : Unit {return} +fun unitShort() : Unit = () +fun unitShortConv() : Unit = 1 +fun unitShortNull() : Unit = null + +fun intEmpty() : Int {} +fun intShortInfer() = 1 +fun intShort() : Int = 1 +fun intBlockInfer() {1} +fun intBlock() : Int {1} + +fun blockReturnUnitMismatch() : Int {return} +fun blockReturnValueTypeMismatch() : Int {return 3.4} +fun blockReturnValueTypeMatch() : Int {return 1}