Change return type quick-fix: Add support of constant expressions

#KT-6260 Fixed
 #KT-6404 Fixed
This commit is contained in:
Alexey Sedunov
2014-12-09 14:24:47 +03:00
parent 2009cc3e9e
commit 51d4d3135e
9 changed files with 97 additions and 5 deletions
@@ -0,0 +1,6 @@
// "Change 'foo' function return type to 'Int?'" "true"
fun foo(): Int? {
val n: Int? = 1
return n
}
@@ -0,0 +1,5 @@
// "Change 'foo' function return type to 'Int'" "true"
fun foo(): Int {
return <caret>1
}
@@ -0,0 +1,5 @@
// "Change 'foo' function return type to 'String?'" "true"
fun foo(): String? {
return null
}
@@ -0,0 +1,6 @@
// "Change 'foo' function return type to 'Int?'" "true"
fun foo(): String {
val n: Int? = 1
return <caret>n
}
@@ -0,0 +1,5 @@
// "Change 'foo' function return type to 'Int'" "true"
fun foo(): String {
return <caret>1
}
@@ -0,0 +1,5 @@
// "Change 'foo' function return type to 'String?'" "true"
fun foo(): String {
return <caret>null
}