Create from usage: Support generation of Java fields from usages in Kotlin code

This commit is contained in:
Alexey Sedunov
2015-02-19 13:20:56 +03:00
parent 34d8e1c08c
commit 19fc9adffa
22 changed files with 194 additions and 7 deletions
@@ -0,0 +1,8 @@
// "Create extension property 'foo'" "true"
// ERROR: Unresolved reference: foo
fun test(): String? {
return A().foo
}
val A.foo: String?
@@ -0,0 +1,6 @@
// "Create extension property 'foo'" "true"
// ERROR: Unresolved reference: foo
fun test(): String? {
return A().<caret>foo
}
@@ -0,0 +1,8 @@
// "Create extension property 'foo'" "true"
// ERROR: Unresolved reference: foo
fun test(): String? {
return A().foo
}
val A.foo: String?
@@ -0,0 +1,6 @@
// "Create extension property 'foo'" "true"
// ERROR: Unresolved reference: foo
fun test(): String? {
return A().<caret>foo
}
@@ -0,0 +1,8 @@
// "Create property 'foo'" "false"
// ACTION: Convert to expression body
// ACTION: Create extension property 'foo'
// ERROR: Unresolved reference: foo
fun test(): String? {
return A().<caret>foo
}
@@ -0,0 +1,10 @@
// "Create property 'foo'" "false"
// ACTION: Convert to expression body
// ACTION: Disable 'Convert to Expression Body'
// ACTION: Edit intention settings
// ACTION: Create extension property 'foo'
// ERROR: Unresolved reference: foo
fun test(a: A): String? {
return a.<caret>foo
}
@@ -0,0 +1,7 @@
import org.jetbrains.annotations.Nullable;
class A {
@Nullable
public final String foo;
}
@@ -0,0 +1,7 @@
// "Create property 'foo'" "true"
// ERROR: Unresolved reference: foo
fun test(): String? {
return A().foo
}
@@ -0,0 +1,6 @@
// "Create property 'foo'" "true"
// ERROR: Unresolved reference: foo
fun test(): String? {
return A().<caret>foo
}
@@ -0,0 +1,7 @@
import org.jetbrains.annotations.NotNull;
class A {
@NotNull
public String foo;
}
@@ -0,0 +1,7 @@
// "Create property 'foo'" "true"
// ERROR: Unresolved reference: foo
fun test() {
A().foo = ""
}
@@ -0,0 +1,6 @@
// "Create property 'foo'" "true"
// ERROR: Unresolved reference: foo
fun test() {
A().<caret>foo = ""
}