J2K does not convert usages of java "get" methods into "[]" (explicit "operator" modifier is required)

This commit is contained in:
Valentin Kipyatkov
2015-10-17 12:06:53 +03:00
parent e7fa2cb776
commit fc10fa66be
5 changed files with 40 additions and 7 deletions
@@ -1,5 +1,6 @@
import java.util.HashMap;
import kotlinApi.KotlinClass;
import javaApi.JavaClass;
class X {
int get(int index) {
@@ -19,4 +20,8 @@ class C {
int foo(KotlinClass kotlinClass) {
return kotlinClass.get(0); // not operator!
}
int foo(JavaClass javaClass) {
return javaClass.get(0);
}
}
+6 -1
View File
@@ -1,6 +1,7 @@
// ERROR: Type mismatch: inferred type is kotlin.String? but kotlin.String was expected
import java.util.HashMap
import kotlinApi.KotlinClass
import javaApi.JavaClass
internal class X {
operator fun get(index: Int): Int {
@@ -20,4 +21,8 @@ internal class C {
fun foo(kotlinClass: KotlinClass): Int {
return kotlinClass.get(0) // not operator!
}
}
fun foo(javaClass: JavaClass): Int {
return javaClass.get(0)
}
}