Quick-Fixes: Approximate non-denotable type with nearest denotable supertype

#KT-5915 Fixed
This commit is contained in:
Alexey Sedunov
2015-03-16 15:33:08 +03:00
parent a2162810ff
commit 1ed2c82008
20 changed files with 251 additions and 46 deletions
@@ -0,0 +1,8 @@
// "Change 'bar' function return type to 'A'" "true"
fun foo() {
open class A
fun bar(): A {
return object: A() {}
}
}
@@ -0,0 +1,10 @@
// "Change parameter 't' type of function 'foo' to 'T'" "true"
trait T
fun Int.foo(t: T) {
}
fun foo() {
1.foo(object: T{})
}
@@ -0,0 +1,8 @@
// "Change parameter 't' type of function 'foo' to 'T'" "true"
trait T
fun Int.foo(t: T) = this
fun foo() {
1 foo object: T{}
}
@@ -0,0 +1,6 @@
// "Change 't' type to 'T'" "true"
trait T
fun foo() {
val t: T = object: T{}
}
@@ -0,0 +1,6 @@
// "Change 'foo' function return type to 'T'" "true"
trait T
fun foo(): T {
return object: T{}
}
@@ -0,0 +1,6 @@
// "Change 'foo' function return type to 'Any'" "true"
fun foo(): Any {
class A
return A()
}
@@ -0,0 +1,10 @@
// "Change 'foo' function return type to 'U'" "true"
trait T
trait U
fun foo(): U {
open class A: T
class B: A(), U
return <caret>B()
}
@@ -0,0 +1,9 @@
// "Change 'foo' function return type to 'T'" "true"
trait T
fun foo(): T {
open class A: T
class B: A()
return B()
}
@@ -0,0 +1,8 @@
// "Change 'bar' function return type to 'A'" "true"
fun foo() {
open class A
fun bar(): Int {
return <caret>object: A() {}
}
}
@@ -0,0 +1,10 @@
// "Change parameter 't' type of function 'foo' to 'T'" "true"
trait T
fun Int.foo(t: Int) {
}
fun foo() {
1.foo(<caret>object: T{})
}
@@ -0,0 +1,8 @@
// "Change parameter 't' type of function 'foo' to 'T'" "true"
trait T
fun Int.foo(t: Int) = this
fun foo() {
1 foo <caret>object: T{}
}
@@ -0,0 +1,6 @@
// "Change 't' type to 'T'" "true"
trait T
fun foo() {
val t: Int = <caret>object: T{}
}
@@ -0,0 +1,6 @@
// "Change 'foo' function return type to 'T'" "true"
trait T
fun foo() {
return <caret>object: T{}
}
@@ -0,0 +1,6 @@
// "Change 'foo' function return type to 'Any'" "true"
fun foo() {
class A
return <caret>A()
}
@@ -0,0 +1,10 @@
// "Change 'foo' function return type to 'U'" "true"
trait T
trait U
fun foo() {
open class A: T
class B: A(), U
return <caret>B()
}
@@ -0,0 +1,9 @@
// "Change 'foo' function return type to 'T'" "true"
trait T
fun foo() {
open class A: T
class B: A()
return <caret>B()
}