Single factory for TYPE_MISMATCH error
This commit is contained in:
+7
@@ -0,0 +1,7 @@
|
||||
// "Change function literal return type to 'String'" "true"
|
||||
fun foo(f: (String) -> Any) {
|
||||
foo {
|
||||
(s: String): String ->
|
||||
s<caret>
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Change function literal return type to 'String'" "true"
|
||||
fun foo() {
|
||||
val f: (String) -> String = {
|
||||
(s: Any): String ->
|
||||
""<caret>
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// "Change 'foo' function return type to '() -> Any'" "true"
|
||||
fun foo(x: Any): () -> Any {
|
||||
return {x<caret>}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Change parameter 'f' type of function 'foo' to '() -> String'" "true"
|
||||
fun foo(f: () -> String) {
|
||||
foo {
|
||||
""<caret>
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Change 'boo' function return type to 'String'" "true"
|
||||
fun boo(): String {
|
||||
return ((if (true) {
|
||||
val a = ""
|
||||
<caret>a
|
||||
} else ""))
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Change 'f' type to '(Int, Int) -> (String) -> Int'" "true"
|
||||
fun foo() {
|
||||
val f: (Int, Int) -> (String) -> Int = {
|
||||
(a: Int, b: Int): (String) -> Int ->
|
||||
val x = {(s: String) -> 42}
|
||||
if (true) x
|
||||
else if (true) x else {
|
||||
var y = 42
|
||||
if (true) x<caret> else x
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Change function literal return type to 'String'" "true"
|
||||
fun foo(f: (String) -> Any) {
|
||||
foo {
|
||||
(s: String): Int ->
|
||||
s<caret>
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Change function literal return type to 'String'" "true"
|
||||
fun foo() {
|
||||
val f: (String) -> String = {
|
||||
(s: Any): Int ->
|
||||
""<caret>
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// "Change 'foo' function return type to '() -> Any'" "true"
|
||||
fun foo(x: Any): () -> Int {
|
||||
return {x<caret>}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Change function 'foo' return type to 'String'" "false"
|
||||
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>jet.Int</td></tr><tr><td>Found:</td><td>jet.String</td></tr></table></html>
|
||||
// ACTION: Disable 'Replace 'if' with 'when''
|
||||
// ACTION: Edit intention settings
|
||||
// ACTION: Replace 'if' with 'when'
|
||||
fun foo(): Int = if (true) ""<caret>: Int else 4
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Change parameter 'f' type of function 'foo' to '() -> String'" "true"
|
||||
fun foo(f: () -> Int) {
|
||||
foo {
|
||||
""<caret>
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Change 'boo' function return type to 'String'" "true"
|
||||
fun boo(): Int {
|
||||
return ((if (true) {
|
||||
val a = ""
|
||||
<caret>a
|
||||
} else ""))
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Change 'f' type to '(Int, Int) -> (String) -> Int'" "true"
|
||||
fun foo() {
|
||||
val f: () -> Long = {
|
||||
(a: Int, b: Int): Long ->
|
||||
val x = {(s: String) -> 42}
|
||||
if (true) x
|
||||
else if (true) x else {
|
||||
var y = 42
|
||||
if (true) x<caret> else x
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user