226d4df277
It was decided to forbid such comparisons, as we know how `===` works. Also, added some more test cases, just for comparison. Reusing the proper `canHaveSubtypes()` from `TypeUtils` prevents a breaking change in: - `comparingTripleWithPair.kt` - `comparisonOfGenericInterfaceWithGenericClass.kt` But it does lead to warnings (instead of errors) in `incompatibleEnumEntryClasses.kt`, which is an unrelated mistake that will be fixed in the next commit. The refactoring in `canHaveSubtypes()` is purely cosmetic - otherwise reading these conditions is hard (and they don't fit my screen vertically). ^KT-62646 ^KT-65541 ^KT-57779
26 lines
264 B
Kotlin
Vendored
26 lines
264 B
Kotlin
Vendored
// FIR_IDENTICAL
|
|
// ISSUE: KT-13451
|
|
|
|
// FILE: J.java
|
|
|
|
public class J {
|
|
}
|
|
|
|
// FILE: Main.kt
|
|
|
|
class K {
|
|
fun f() {}
|
|
}
|
|
|
|
fun test (j: J, k: K) {
|
|
j == K::f
|
|
j == k::f
|
|
|
|
j === K::f
|
|
j === k::f
|
|
|
|
when (j) {
|
|
k::f -> ""
|
|
K::f -> ""
|
|
}
|
|
} |