From 646451ae965ad1be98f0727218ff58308157825d Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 18 Jun 2012 21:49:44 +0400 Subject: [PATCH] test for KT-2216 --- .../tests/nullabilityAndAutoCasts/kt2216.jet | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt2216.jet diff --git a/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt2216.jet b/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt2216.jet new file mode 100644 index 00000000000..4fccab1539d --- /dev/null +++ b/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt2216.jet @@ -0,0 +1,20 @@ +//KT-2216 Nullability of a value determined in function parameter computation doesn't pass to code following +package kt2216 + +fun bar(y: Int, z: Int) = y + z +fun baz(a: Int, b: Int, c: Int, d: Int) = a + b + c + d + +fun foo() { + val x: Int? = 0 + + bar(if (x != null) x else return, x) + x + 2 + bar(x, x!!) + + val y: Int? = 0 + val z: Int? = 0 + bar(if (y != null) y else z, y) + y + 2 + baz(y, y, if (y == null) return else y, y) + baz(y, z!!, z, y) +}