Fix overload ambiguity after smartcast to nullable Nothing
#KT-39544 Fixed
This commit is contained in:
@@ -11,7 +11,7 @@ public class My {
|
||||
fun test() {
|
||||
val my = My.create()
|
||||
if (my == null) {
|
||||
<!OI;DEBUG_INFO_CONSTANT!>my<!><!OI;UNSAFE_CALL!>.<!>foo()
|
||||
<!OI;DEBUG_INFO_CONSTANT!>my<!><!UNSAFE_CALL!>.<!>foo()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
// FILE: B.java
|
||||
|
||||
public abstract class B<T> implements A<T> {}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
interface A<T> {
|
||||
val content: T
|
||||
}
|
||||
fun f(x: Any?) {}
|
||||
fun f(x: Byte) {}
|
||||
fun f(x: Char) {}
|
||||
|
||||
fun g(i: Int) {}
|
||||
|
||||
fun g(x: B<Int>) {
|
||||
val y = x.content
|
||||
if (y == null) {
|
||||
f(y)
|
||||
g(y)
|
||||
}
|
||||
|
||||
if (y is Nothing?) {
|
||||
<!AMBIGUITY!>f<!>(y)
|
||||
<!AMBIGUITY!>g<!>(y)
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
// FILE: B.java
|
||||
|
||||
public abstract class B<T> implements A<T> {}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
interface A<T> {
|
||||
val content: T
|
||||
}
|
||||
fun f(x: Any?) {}
|
||||
fun f(x: Byte) {}
|
||||
fun f(x: Char) {}
|
||||
|
||||
fun g(i: Int) {}
|
||||
|
||||
fun g(x: B<Int>) {
|
||||
val y = x.content
|
||||
if (y == null) {
|
||||
f(<!DEBUG_INFO_CONSTANT!>y<!>)
|
||||
<!NONE_APPLICABLE!>g<!>(<!DEBUG_INFO_CONSTANT!>y<!>)
|
||||
}
|
||||
|
||||
if (y is Nothing?) {
|
||||
f(y)
|
||||
<!NONE_APPLICABLE!>g<!>(y)
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package
|
||||
|
||||
public fun f(/*0*/ x: kotlin.Any?): kotlin.Unit
|
||||
public fun f(/*0*/ x: kotlin.Byte): kotlin.Unit
|
||||
public fun f(/*0*/ x: kotlin.Char): kotlin.Unit
|
||||
public fun g(/*0*/ x: B<kotlin.Int>): kotlin.Unit
|
||||
public fun g(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||
|
||||
public interface A</*0*/ T> {
|
||||
public abstract val content: 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 abstract class B</*0*/ T : kotlin.Any!> : A<T!> {
|
||||
public constructor B</*0*/ T : kotlin.Any!>()
|
||||
public abstract override /*1*/ /*fake_override*/ val content: 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
|
||||
}
|
||||
Reference in New Issue
Block a user