69a7bf7f68
This fixes some cases where we infer some type variable inside one of the branches to Nothing instead of the expected type because Nothing appeared in some other branch. Specifically, we add an equality instead of a subtype constraint during completion of calls to synthetic functions for if/when, try and !!. We don't do it when the call contains a (possibly nested) elvis or is inside the RHS of an assignment. Otherwise, we would prevent some smart-casts. #KT-65882 Fixed
22 lines
332 B
Kotlin
Vendored
22 lines
332 B
Kotlin
Vendored
// TARGET_BACKEND: JVM
|
|
|
|
// FILE: Java1.java
|
|
|
|
public class Java1 {
|
|
public static int a = 2;
|
|
public static void foo(Object t) { }
|
|
public static Object bar() {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
// FILE: 1.kt
|
|
|
|
class A : Java1()
|
|
|
|
class B : Java1() {
|
|
fun foo(t: String) {}
|
|
fun bar(): String {
|
|
return null!!
|
|
}
|
|
} |