KT-9498 extension: now type can be inferred for getter with expression body

This commit is contained in:
Mikhail Glukhikh
2016-02-17 13:09:20 +03:00
parent 405c21a17e
commit 883e2e4d2b
13 changed files with 108 additions and 9 deletions
@@ -0,0 +1,12 @@
// "Specify type explicitly" "false"
// ERROR: This property must either have a type annotation, be initialized or be delegated
// ACTION: Convert member to extension
// ACTION: Convert property to function
// ACTION: Move to companion object
class My {
val <caret>x
get() {
return 3.14
}
}
@@ -0,0 +1,6 @@
// "Specify type explicitly" "true"
class My {
val <caret>x
get() = "abc"
}
@@ -0,0 +1,6 @@
// "Specify type explicitly" "true"
class My {
val x: String
get() = "abc"
}
@@ -0,0 +1,7 @@
// "Specify type explicitly" "false"
// ERROR: This property must either have a type annotation, be initialized or be delegated
class A {
val a
get() = a
}