drop BASE_WITH_NULLABLE_UPPER_BOUND

This commit is contained in:
Michael Nedzelsky
2015-10-14 19:15:08 +03:00
parent ced1edcf98
commit 57205f5721
24 changed files with 23 additions and 46 deletions
+2 -3
View File
@@ -3,11 +3,10 @@ public inline fun <reified T> Array(n: Int, block: (Int) -> T): Array<T> = null!
// KT-312 Nullability problem when a nullable version of a generic type is returned
fun <T> Array<out T>.safeGet(index : Int) : T<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!> {
fun <T> Array<out T>.safeGet(index : Int) : T? {
return if (index < size()) this[index] else null
}
val args : Array<String> = Array<String>(1, {""})
val name : String = <!TYPE_MISMATCH!>args.safeGet<String>(0)<!> // No error, must be type mismatch
val name1 : String? = args.safeGet(0)
val name1 : String? = args.safeGet(0)