Introduce Parameter: Do not apply to expressions of type Unit or Nothing

This commit is contained in:
Alexey Sedunov
2015-04-09 20:37:37 +03:00
parent 54392e7064
commit da14222c4a
16 changed files with 86 additions and 5 deletions
@@ -0,0 +1,6 @@
fun foo(): Int {
var x = 1
<selection>x = x + 1</selection>
return 1 + x
}
@@ -0,0 +1 @@
Cannot introduce parameter of type 'Unit'
@@ -0,0 +1,5 @@
fun foo(): Int {
<selection>fun bar() = 1</selection>
return 1 + bar()
}
@@ -0,0 +1 @@
Cannot introduce parameter of type 'Unit'
@@ -0,0 +1,5 @@
fun foo(): Int {
<selection>val x = 1</selection>
return 1 + x
}
@@ -0,0 +1 @@
Cannot introduce parameter of type 'Unit'
@@ -0,0 +1,3 @@
fun foo(): Int {
<selection>return 1</selection>
}
@@ -0,0 +1 @@
Cannot introduce parameter of type 'Nothing'
@@ -0,0 +1,3 @@
fun foo(): Int {
<selection>throw Exception()</selection>
}
@@ -0,0 +1 @@
Cannot introduce parameter of type 'Nothing'
@@ -0,0 +1,5 @@
fun foo(): Int {
<selection>while (false) {}</selection>
return 1
}
@@ -0,0 +1 @@
Cannot introduce parameter of type 'Unit'