By the way, are the bugs in this example known (or...
# announcements
d
By the way, are the bugs in this example known (or am I doing something wrong?)? I couldn't find any evidence of them on the bug tracker:
Copy code
public class ProblemClass<T>(){ //changing this to T: Any? resolves the issues in this example
    //If T compile error: Error:(3, 23) Kotlin: Null can not be a value of a non-null type T
    //If T? warns: Warning:(4, 20) Kotlin: 'T' has a nullable upper bound.  This means that a value of this type may be null. Using 'T?' is likely to mislead the reader
    var someItem: T? = null

    fun foo() {
        if(someItem == null) {
            System.out.println("Oh null")
        } else {
            //I would expect this to be smartcast to non-null T
            //Error:(12, 28) Kotlin: Type mismatch: inferred type is T? but T was expected
            noNullsAllowed(someItem!!)
        }
    }

    fun noNullsAllowed(t: T) {
    }
}