diff --git a/translator/src/test/kotlin/tests/input/smartcast_1.txt b/translator/src/test/kotlin/tests/input/smartcast_1.txt new file mode 100644 index 00000000000..5343a057e00 --- /dev/null +++ b/translator/src/test/kotlin/tests/input/smartcast_1.txt @@ -0,0 +1 @@ +smartcast_1() == 4 diff --git a/translator/src/test/kotlin/tests/kotlin/dfs_1.kt b/translator/src/test/kotlin/tests/kotlin/dfs_1.kt index ace616fe1e2..dcd5fedb968 100644 --- a/translator/src/test/kotlin/tests/kotlin/dfs_1.kt +++ b/translator/src/test/kotlin/tests/kotlin/dfs_1.kt @@ -40,6 +40,6 @@ fun dfs_1(searchObject: Int): Int { if (result == null) { return -101 } else { - return result!!.value + return result.value } } \ No newline at end of file diff --git a/translator/src/test/kotlin/tests/kotlin/nullable_primitive_types_1.kt b/translator/src/test/kotlin/tests/kotlin/nullable_primitive_types_1.kt index b5771ff5cea..eaed37364bb 100644 --- a/translator/src/test/kotlin/tests/kotlin/nullable_primitive_types_1.kt +++ b/translator/src/test/kotlin/tests/kotlin/nullable_primitive_types_1.kt @@ -5,7 +5,7 @@ fun nullable_primitive_types_1_small(): Int { return art!! } -fun nullable_primitive_types_1_extern(x: Int): Int { +fun nullable_primitive_types_1_extern(x: Int): Int { val variable: Int? = x val art: Int? = variable!! + 8 return art!! @@ -13,32 +13,29 @@ fun nullable_primitive_types_1_extern(x: Int): Int { fun nullable_primitive_types_1_if_null(): Int { val variable: Int? = null - if (variable == null){ + if (variable == null) { return 11 - } - else{ + } else { return 2245 } } fun nullable_primitive_types_1_if_not_null(): Int { val variable: Int? = null - if (variable != null){ + if (variable != null) { return 11 - } - else{ + } else { return 2245 } } -fun nullable_primitive_types_1_reassignment():Int{ - var z:Int? = 32 +fun nullable_primitive_types_1_reassignment(): Int { + var z: Int? = 32 z = null var r = z - if (r == null){ + if (r == null) { return 5678 - } - else{ + } else { return 13 } } \ No newline at end of file diff --git a/translator/src/test/kotlin/tests/kotlin/numeric_literals_1.kt b/translator/src/test/kotlin/tests/kotlin/numeric_literals_1.kt index 8fb70fbdfcf..f28935d2e7f 100644 --- a/translator/src/test/kotlin/tests/kotlin/numeric_literals_1.kt +++ b/translator/src/test/kotlin/tests/kotlin/numeric_literals_1.kt @@ -7,7 +7,7 @@ fun numeric_literals_1_LL(): Long { return k } -fun numeric_literals_1_Binary(): Int{ +fun numeric_literals_1_Binary(): Int { val k = 0b01111111 return k } diff --git a/translator/src/test/kotlin/tests/kotlin/smartcast_1.kt b/translator/src/test/kotlin/tests/kotlin/smartcast_1.kt new file mode 100644 index 00000000000..1ba463a1ae2 --- /dev/null +++ b/translator/src/test/kotlin/tests/kotlin/smartcast_1.kt @@ -0,0 +1,11 @@ +fun smartcast_1_CastCheck(x: Int): Int { + return x + 1 +} + +fun smartcast_1(): Int { + var x: Int? = null + x = 3 + val y = x + val uio = smartcast_1_CastCheck(y) + return uio +} \ No newline at end of file