Original type is taken into account when intersecting possible types in resolve #KT-10232 Fixed

This commit is contained in:
Mikhail Glukhikh
2015-11-30 17:36:12 +03:00
committed by Stanislav Erokhin
parent db2521ee67
commit fe04cc513b
5 changed files with 39 additions and 2 deletions
@@ -38,7 +38,7 @@ fun <T : CharSequence?> foo(x: T) {
<!DEBUG_INFO_SMARTCAST!>x<!>.length
x<!UNNECESSARY_SAFE_CALL!>?.<!>length
<!DEBUG_INFO_SMARTCAST!>x<!>.bar1()
x.bar1()
x.bar2()
<!DEBUG_INFO_SMARTCAST!>x<!>.bar3()
}
@@ -0,0 +1,15 @@
// Type inference failed after smart cast
interface A<T>
interface B<T> : A<T>
fun <T> foo(b: A<T>) = b
fun <T> test(a: A<T>) {
if (a is Any) {
// Error:(9, 9) Kotlin: Type inference failed: fun <T> foo(b: A<T>): kotlin.Unit
// cannot be applied to (A<T>)
foo(a)
}
foo(a) // ok
}
@@ -0,0 +1,16 @@
package
public fun </*0*/ T> foo(/*0*/ b: A<T>): A<T>
public fun </*0*/ T> test(/*0*/ a: A<T>): kotlin.Unit
public interface A</*0*/ T> {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface B</*0*/ T> : A<T> {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}