KT-6774 Cannot find equals() when comparing with null
#KT-6774 Fixed
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// KT-6774 Cannot find equals() when comparing with null
|
||||
|
||||
fun <T: Any> fn(t1: T, t2: T?) {
|
||||
val x = if (true) t1 else t2
|
||||
x == null
|
||||
x?.equals(null)
|
||||
x?.hashCode()
|
||||
x.toString()
|
||||
x!!.hashCode()
|
||||
|
||||
val y = t2 ?: t1
|
||||
y == t1
|
||||
y.equals(null)
|
||||
y.hashCode()
|
||||
y.toString()
|
||||
y.hashCode()
|
||||
}
|
||||
|
||||
trait Tr {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
fun <T: Tr> fn(t1: T, t2: T?) {
|
||||
val x = if (true) t1 else t2
|
||||
x?.foo()
|
||||
x!!.foo()
|
||||
|
||||
val y = t2 ?: t1
|
||||
y.foo()
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package
|
||||
|
||||
internal fun </*0*/ T : Tr> fn(/*0*/ t1: T, /*1*/ t2: T?): kotlin.Unit
|
||||
internal fun </*0*/ T : kotlin.Any> fn(/*0*/ t1: T, /*1*/ t2: T?): kotlin.Unit
|
||||
|
||||
internal trait Tr {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal abstract fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -1950,6 +1950,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/controlStructures"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("commonSupertypeOfT.kt")
|
||||
public void testCommonSupertypeOfT() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/controlStructures/commonSupertypeOfT.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("emptyIf.kt")
|
||||
public void testEmptyIf() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/controlStructures/emptyIf.kt");
|
||||
|
||||
Reference in New Issue
Block a user