Create From Usage: Add support of get/set functions in property delegates

#KT-5977 Fixed
This commit is contained in:
Alexey Sedunov
2014-10-17 16:41:12 +04:00
parent d4a9b922e5
commit f5f1aec47b
16 changed files with 283 additions and 55 deletions
@@ -0,0 +1,11 @@
// "Create function 'get' from usage" "true"
class F {
fun get(x: X, propertyMetadata: PropertyMetadata): Int {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
class X {
val f: Int by F()
}
@@ -0,0 +1,15 @@
// "Create function 'get', function 'set' from usage" "true"
class F {
fun get(x: X, propertyMetadata: PropertyMetadata): Int {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
fun set(x: X, propertyMetadata: PropertyMetadata, i: Int) {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
class X {
var f: Int by F()
}
@@ -0,0 +1,12 @@
// "Create function 'get' from usage" "true"
class F {
fun set(x: X, propertyMetadata: PropertyMetadata, i: Int) { }
fun get(x: X, propertyMetadata: PropertyMetadata): Int {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
class X {
var f: Int by F()
}
@@ -0,0 +1,12 @@
// "Create function 'set' from usage" "true"
class F {
fun get(x: X, propertyMetadata: PropertyMetadata): Int = 1
fun set(x: X, propertyMetadata: PropertyMetadata, i: Int) {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
class X {
var f: Int by F()
}
@@ -0,0 +1,8 @@
// "Create function 'get' from usage" "true"
class F {
}
class X {
val f: Int by F()<caret>
}
@@ -0,0 +1,8 @@
// "Create function 'get', function 'set' from usage" "true"
class F {
}
class X {
var f: Int by F()<caret>
}
@@ -0,0 +1,8 @@
// "Create function 'get' from usage" "true"
class F {
fun set(x: X, propertyMetadata: PropertyMetadata, i: Int) { }
}
class X {
var f: Int by F()<caret>
}
@@ -0,0 +1,8 @@
// "Create function 'set' from usage" "true"
class F {
fun get(x: X, propertyMetadata: PropertyMetadata): Int = 1
}
class X {
var f: Int by F()<caret>
}