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

This commit is contained in:
Mikhail Glukhikh
2015-12-07 11:46:37 +03:00
parent 96d0c4a1db
commit 2e73bcb3a6
4 changed files with 39 additions and 6 deletions
@@ -0,0 +1,18 @@
class Foo(var x: Int?) {
init {
if (x != null) {
val y = x
// Error: x is not stable, Type(y) = Int?
<!SMARTCAST_IMPOSSIBLE!>x<!>.hashCode()
y<!UNSAFE_CALL!>.<!>hashCode()
if (y == x) {
// Still error
y<!UNSAFE_CALL!>.<!>hashCode()
}
if (x == null && y != x) {
// Still error
y<!UNSAFE_CALL!>.<!>hashCode()
}
}
}
}
@@ -0,0 +1,9 @@
package
public final class Foo {
public constructor Foo(/*0*/ x: kotlin.Int?)
public final var x: kotlin.Int?
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
}