Extract Function: Replace non-denotable parameter types with their super types when possible
#KT-6187 Fixed
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
// SIBLING:
|
||||
val x = object {
|
||||
val t = 1
|
||||
|
||||
fun test() {
|
||||
<selection>println(this.t)</selection>
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
Cannot extract method since following types are not denotable in the target scope: <no name provided>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// PARAM_DESCRIPTOR: internal final class <no name provided> defined in root package
|
||||
// PARAM_TYPES: kotlin.Any
|
||||
// WITH_RUNTIME
|
||||
|
||||
// SIBLING:
|
||||
val x = object {
|
||||
fun test() {
|
||||
<selection>println(this)</selection>
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// PARAM_DESCRIPTOR: internal final class <no name provided> defined in root package
|
||||
// PARAM_TYPES: kotlin.Any
|
||||
// WITH_RUNTIME
|
||||
|
||||
// SIBLING:
|
||||
val x = object {
|
||||
fun test() {
|
||||
unit()
|
||||
}
|
||||
}
|
||||
|
||||
private fun Any.unit() {
|
||||
println(this)
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// PARAM_DESCRIPTOR: val x: <no name provided> defined in test
|
||||
// PARAM_TYPES: A
|
||||
// WITH_RUNTIME
|
||||
|
||||
open class A {
|
||||
|
||||
}
|
||||
|
||||
fun foo(a: A) {
|
||||
|
||||
}
|
||||
|
||||
// SIBLING:
|
||||
fun test() {
|
||||
val x = object: A() { }
|
||||
<selection>foo(x)</selection>
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// PARAM_DESCRIPTOR: val x: <no name provided> defined in test
|
||||
// PARAM_TYPES: A
|
||||
// WITH_RUNTIME
|
||||
|
||||
open class A {
|
||||
|
||||
}
|
||||
|
||||
fun foo(a: A) {
|
||||
|
||||
}
|
||||
|
||||
// SIBLING:
|
||||
fun test() {
|
||||
val x = object: A() { }
|
||||
unit(x)
|
||||
}
|
||||
|
||||
private fun unit(x: A) {
|
||||
foo(x)
|
||||
}
|
||||
Reference in New Issue
Block a user