DFA bug fix: assignment of unstable to stable uses predictable type set (see test)

This commit is contained in:
Mikhail Glukhikh
2015-12-07 12:17:29 +03:00
parent 2e73bcb3a6
commit 5c9e55f3fb
6 changed files with 72 additions and 11 deletions
@@ -0,0 +1,22 @@
class Bar {
fun bar() {}
}
class Foo(var x: Any) {
init {
if (x is Bar) {
val y = x
// Error: x is not stable, Type(y) = Any
<!SMARTCAST_IMPOSSIBLE!>x<!>.bar()
y.<!UNRESOLVED_REFERENCE!>bar<!>()
if (y == x) {
// Still error
y.<!UNRESOLVED_REFERENCE!>bar<!>()
}
if (x !is Bar && y != x) {
// Still error
y.<!UNRESOLVED_REFERENCE!>bar<!>()
}
}
}
}
@@ -0,0 +1,17 @@
package
public final class Bar {
public constructor Bar()
public final fun bar(): kotlin.Unit
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 final class Foo {
public constructor Foo(/*0*/ x: kotlin.Any)
public final var x: kotlin.Any
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
}