Files
kotlin-fork/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt2234.kt
T
2013-12-11 19:53:50 +04:00

22 lines
604 B
Kotlin

package a
//KT-2234 'period!!' has type Int?
class Pair<A, B>(val a: A, val b: B)
fun main(args : Array<String>) {
val d : Long = 1
val period : Int? = null
if (period != null) Pair(d, period<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!> : Int) else Pair(d, 1)
if (period != null) Pair(d, <!DEBUG_INFO_AUTOCAST!>period<!> : Int) else Pair(d, 1)
}
fun foo() {
val x : Int? = 3
if (x != null) {
val <!UNUSED_VARIABLE!>u<!> = x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!> : Int
val y = <!DEBUG_INFO_AUTOCAST!>x<!> : Int
val <!UNUSED_VARIABLE!>z<!> : Int = y
}
}