From 0609f61ee7263077ea827405878abd05af835a91 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Wed, 24 Jul 2013 13:32:35 +0400 Subject: [PATCH] added test for nontrivial nested calls --- .../nestedCalls/nontrivialCallExpression.kt | 18 ++++++++++++++++++ .../checkers/JetDiagnosticsTestGenerated.java | 5 +++++ 2 files changed, 23 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.kt diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.kt new file mode 100644 index 00000000000..6ffaefd75f3 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.kt @@ -0,0 +1,18 @@ +package a + +fun foo(l: List): Int = l.get(0) + +fun emptyList(): List = throw Exception() + +fun makeNullable(t: T): T? = null + +fun bar(i: Int) = i +fun bar(a: Any) = a + +fun test(array: Array) { + bar(array[foo(emptyList())]) + + bar(foo(emptyList()) + foo(a.emptyList())) + + bar(makeNullable(foo(emptyList())) ?: 0) +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java index 751c26edd0f..89ecf10b247 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java @@ -2861,6 +2861,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage doTest("compiler/testData/diagnostics/tests/inference/nestedCalls/kt3461checkTypes.kt"); } + @TestMetadata("nontrivialCallExpression.kt") + public void testNontrivialCallExpression() throws Exception { + doTest("compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.kt"); + } + } @TestMetadata("compiler/testData/diagnostics/tests/inference/regressions")