Choose Java field during overload resolution with a pure Kotlin property

^KT-31244 Fixed
This commit is contained in:
Denis Zharkov
2019-12-17 17:58:49 +03:00
parent aa8578b675
commit e8131d6e30
20 changed files with 326 additions and 3 deletions
@@ -0,0 +1,27 @@
// SKIP_TXT
// !LANGUAGE: +PreferJavaFieldOverload +NewInference
// !CHECK_TYPE
// FILE: CompressionType.java
public enum CompressionType {
ZIP(1.0);
public final double name;
CompressionType(double name) {
this.name = name;
}
}
// FILE: CollectionWithSize.java
public abstract class CollectionWithSize implements java.util.Collection<String> {
public final String size = "";
}
// FILE: main.kt
fun main(c: CollectionWithSize) {
CompressionType.ZIP.name checkType { _<Double>() }
c.size checkType { _<String>() }
CompressionType.ZIP::name checkType { _<kotlin.reflect.KProperty0<Double>>() }
c::size checkType { _<kotlin.reflect.KProperty0<String>>() }
}