translator: add smartcast test

This commit is contained in:
Alexey Stepanov
2016-08-23 13:43:10 +03:00
parent 134067ed0d
commit 25d4c70d3f
5 changed files with 23 additions and 14 deletions
@@ -0,0 +1 @@
smartcast_1() == 4
@@ -40,6 +40,6 @@ fun dfs_1(searchObject: Int): Int {
if (result == null) {
return -101
} else {
return result!!.value
return result.value
}
}
@@ -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
}
}
@@ -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
}
@@ -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
}