KT-2842 Function with declared non-null receiver resolves with nullable argument receiver

#KT-2842 fixed
This commit is contained in:
Svetlana Isakova
2012-09-29 21:06:24 +04:00
parent 069ef8ef91
commit 9d5f5f7adf
5 changed files with 54 additions and 13 deletions
@@ -0,0 +1,27 @@
package c
trait A<T>
fun test(a: A<Int>?) {
a<!UNSAFE_CALL!>.<!>foo() //no error
}
fun <R> A<R>.foo() {}
//------------
fun test(nullabilityInfoMap: Map<Int, Any>?) {
nullabilityInfoMap<!UNSAFE_CALL!>.<!>iterator() //no error
}
//resolves to
public inline fun <K,V> Map<K,V>.iterator(): Iterator<Map.Entry<K,V>> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
//-------------
fun foo() : Boolean {
val nullableList = getNullableList()
return nullableList<!UNSAFE_CALL!>.<!>contains("")
}
fun getNullableList(): List<String>? = null