diff --git a/compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt b/compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt index 769fa72bd6a..031a8581e01 100644 --- a/compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt +++ b/compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt @@ -6,4 +6,6 @@ fun foo1() { fooT22() } -val n : Nothing = null.sure() \ No newline at end of file +val n : Nothing = null!! + +fun T?.sure() : T = this!! diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt1358.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt1358.kt index 395bf4371ae..5c28166bb42 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt1358.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt1358.kt @@ -8,4 +8,5 @@ fun bar(a: Any?) { } } -fun T?.foo() {} \ No newline at end of file +fun T?.foo() {} +fun T?.sure() : T = this!! \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt1558.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt1558.kt index 6f1a50b4e29..2ec9436e4a2 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt1558.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt1558.kt @@ -1,7 +1,9 @@ //KT-1558 Exception while analyzing package j -fun testArrays(val ci: List, val cii: List) { +fun T?.sure() : T = this!! + +fun testArrays(val ci: List, val cii: List?) { val c1: Array = cii.sure().toArray(Array) val c2: Array = ci.toArray(Array()) diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt742.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt742.kt index 1e32ffc67a0..d8f1846148c 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt742.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt742.kt @@ -1,6 +1,8 @@ //KT-742 Stack overflow in type inference package a +fun T?.sure() : T = this!! + class List(val head: T, val tail: List? = null) fun List.map1(f: (T)-> Q): List? = tail!!.map1(f) diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt943.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt943.kt index ed0987b815f..2df5de1d2f4 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt943.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt943.kt @@ -15,4 +15,6 @@ fun foo(lines: List) { } //standard library +fun T?.sure() : T = this!! + public inline fun comparator(fn: (T,T) -> Int): Comparator {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt557.kt b/compiler/testData/diagnostics/tests/regressions/kt557.kt index 4ac9a61049c..993d2703426 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt557.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt557.kt @@ -1,5 +1,7 @@ // KT-557 Wrong type inference near sure extension function +fun T?.sure() : T = this!! + fun Array.length() : Int { return 0; } diff --git a/compiler/testData/diagnostics/tests/regressions/kt630.kt b/compiler/testData/diagnostics/tests/regressions/kt630.kt index 2b26b0faa1e..2cef7f519a8 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt630.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt630.kt @@ -1,3 +1,6 @@ // KT-630 Bad type inference + +fun T?.sure() : T = this!! + val x = "lala".sure() val s : String = x diff --git a/compiler/testData/diagnostics/tests/regressions/kt743.kt b/compiler/testData/diagnostics/tests/regressions/kt743.kt index f508c0af0bd..4d29b36c57d 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt743.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt743.kt @@ -1,5 +1,7 @@ //KT-743 Wrong type inference class List(val head: T, val tail: List? = null) +fun T?.sure() : T = this!! + fun List.map(f: (T)-> Q): List? = tail.sure>().map(f) fun foo(t : T) : T = foo(t) diff --git a/compiler/testData/diagnostics/tests/regressions/kt750.kt b/compiler/testData/diagnostics/tests/regressions/kt750.kt index dbbf53c08bb..b37f565ee9c 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt750.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt750.kt @@ -3,6 +3,8 @@ fun main(args : Array) { 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?.sure() : T = this!!