KT-9498 extension: now type can be inferred for getter with expression body
This commit is contained in:
@@ -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"
|
||||
}
|
||||
+6
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user