Added custom "sure" function in some diagnostic tests, because it is being removed from builtins.
This commit is contained in:
@@ -6,4 +6,6 @@ fun foo1() {
|
||||
<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>fooT22<!>()
|
||||
}
|
||||
|
||||
val n : Nothing = null.sure()
|
||||
val n : Nothing = null!!
|
||||
|
||||
fun <T : Any> T?.sure() : T = this!!
|
||||
|
||||
@@ -8,4 +8,5 @@ fun bar(a: Any?) {
|
||||
}
|
||||
}
|
||||
|
||||
fun <T : Any> T?.foo() {}
|
||||
fun <T : Any> T?.foo() {}
|
||||
fun <T : Any> T?.sure() : T = this!!
|
||||
@@ -1,7 +1,9 @@
|
||||
//KT-1558 Exception while analyzing
|
||||
package j
|
||||
|
||||
fun testArrays(val ci: List<Int?>, val cii: List<Int?>) {
|
||||
fun <T : Any> T?.sure() : T = this!!
|
||||
|
||||
fun testArrays(val ci: List<Int?>, val cii: List<Int?>?) {
|
||||
val c1: Array<Int?> = cii.sure().toArray(<!FUNCTION_CALL_EXPECTED!><!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>Array<!><Int?><!>)
|
||||
|
||||
val c2: Array<Int?> = ci.toArray(Array<Int?><!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>()<!>)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
//KT-742 Stack overflow in type inference
|
||||
package a
|
||||
|
||||
fun <T : Any> T?.sure() : T = this!!
|
||||
|
||||
class List<T>(val head: T, val tail: List<T>? = null)
|
||||
|
||||
fun <T, Q> List<T>.map1(f: (T)-> Q): List<T>? = tail!!.map1(f)
|
||||
|
||||
@@ -15,4 +15,6 @@ fun foo(lines: List<String>) {
|
||||
}
|
||||
|
||||
//standard library
|
||||
fun <T : Any> T?.sure() : T = this!!
|
||||
|
||||
public inline fun <T> comparator(<!UNUSED_PARAMETER!>fn<!>: (T,T) -> Int): Comparator<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
@@ -1,5 +1,7 @@
|
||||
// KT-557 Wrong type inference near sure extension function
|
||||
|
||||
fun <T : Any> T?.sure() : T = this!!
|
||||
|
||||
fun Array<String>.length() : Int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// KT-630 Bad type inference
|
||||
|
||||
fun <T : Any> T?.sure() : T = this!!
|
||||
|
||||
val x = "lala".sure()
|
||||
val s : String = x
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
//KT-743 Wrong type inference
|
||||
class List<T>(val head: T, val tail: List<T>? = null)
|
||||
|
||||
fun <T : Any> T?.sure() : T = this!!
|
||||
|
||||
fun <T, Q> List<T>.map(f: (T)-> Q): List<T>? = tail.sure<List<T>>().map(f)
|
||||
fun foo<T>(t : T) : T = foo(t)
|
||||
|
||||
@@ -3,6 +3,8 @@ fun main(args : Array<String>) {
|
||||
var i : Int? = Integer.valueOf(100)
|
||||
var s : Int? = Integer.valueOf(100)
|
||||
|
||||
val o = i .sure() + s.sure()
|
||||
val o = i.sure() + s.sure()
|
||||
System.out.println(o)
|
||||
}
|
||||
|
||||
fun <T : Any> T?.sure() : T = this!!
|
||||
|
||||
Reference in New Issue
Block a user