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")