Create Function From Usage: Use Any if error type is inferred
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
// "Create function 'foo' from usage" "true"
|
||||
|
||||
fun run<T>(f: () -> T) = f()
|
||||
|
||||
fun test() {
|
||||
run { foo() }
|
||||
}
|
||||
|
||||
fun foo(): Any {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Create function 'foo' from usage" "true"
|
||||
// ERROR: Unresolved reference: B
|
||||
|
||||
class A: B {
|
||||
fun foo(): Any {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A().foo()
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Create function 'foo' from usage" "true"
|
||||
|
||||
fun run<T>(f: () -> T) = f()
|
||||
|
||||
fun test() {
|
||||
run { <caret>foo() }
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Create function 'foo' from usage" "true"
|
||||
// ERROR: Unresolved reference: B
|
||||
|
||||
class A: B {
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A().<caret>foo()
|
||||
}
|
||||
Reference in New Issue
Block a user