Move: Fix processing of references to non-real members of companion object

#KT-15559 Fixed
This commit is contained in:
Alexey Sedunov
2017-03-12 19:04:42 +03:00
parent bab762b761
commit 6f5249ecc7
21 changed files with 273 additions and 7 deletions
@@ -0,0 +1,13 @@
package source
class Logger {
fun debug(s: () -> String) {
}
}
open class Klogging
val Klogging.loggerExt: Logger get() = Logger
fun Klogging.logExt(s: String) {}
@@ -0,0 +1,14 @@
package target
import source.Klogging
import source.logExt
import source.loggerExt
class Foo {
companion object : Klogging()
fun baz() {
loggerExt.debug { "something" }
logExt("something")
}
}
@@ -0,0 +1,21 @@
package source
class Logger {
fun debug(s: () -> String) {
}
}
open class Klogging
val Klogging.loggerExt: Logger get() = Logger
fun Klogging.logExt(s: String) {}
class <caret>Foo {
companion object : Klogging()
fun baz() {
loggerExt.debug { "something" }
logExt("something")
}
}
@@ -0,0 +1,5 @@
{
"mainFile": "source/Foo.kt",
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
"targetPackage": "target"
}
@@ -0,0 +1,18 @@
package source
class Logger {
fun debug(s: () -> String) {
}
}
interface ILogging {
val logger: Logger
fun log(s: String)
}
class Klogging : ILogging {
override val logger = Logger()
override fun log(s: String) {}
}
@@ -0,0 +1,13 @@
package target
import source.ILogging
import source.Klogging
class Foo {
companion object : ILogging by Klogging()
fun baz() {
logger.debug { "something" }
log("something")
}
}
@@ -0,0 +1,26 @@
package source
class Logger {
fun debug(s: () -> String) {
}
}
interface ILogging {
val logger: Logger
fun log(s: String)
}
class Klogging : ILogging {
override val logger = Logger()
override fun log(s: String) {}
}
class <caret>Foo {
companion object : ILogging by Klogging()
fun baz() {
logger.debug { "something" }
log("something")
}
}
@@ -0,0 +1,5 @@
{
"mainFile": "source/Foo.kt",
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
"targetPackage": "target"
}
@@ -0,0 +1,13 @@
package source
class Logger {
fun debug(s: () -> String) {
}
}
open class Klogging {
val logger = Logger()
fun log(s: String) {}
}
@@ -0,0 +1,12 @@
package target
import source.Klogging
class Foo {
companion object : Klogging()
fun baz() {
logger.debug { "something" }
log("something")
}
}
@@ -0,0 +1,21 @@
package source
class Logger {
fun debug(s: () -> String) {
}
}
open class Klogging {
val logger = Logger()
fun log(s: String) {}
}
class <caret>Foo {
companion object : Klogging()
fun baz() {
logger.debug { "something" }
log("something")
}
}
@@ -0,0 +1,5 @@
{
"mainFile": "source/Foo.kt",
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
"targetPackage": "target"
}
@@ -0,0 +1,8 @@
package source
class Logger {
fun debug(s: () -> String) {
}
}
@@ -0,0 +1,6 @@
package source;
public class Klogging {
public Logger logger = Logger();
public void log(String s) {}
}
@@ -0,0 +1,12 @@
package target
import source.Klogging
class Foo {
companion object : Klogging()
fun baz() {
logger.debug { "something" }
log("something")
}
}
@@ -0,0 +1,16 @@
package source
class Logger {
fun debug(s: () -> String) {
}
}
class <caret>Foo {
companion object : Klogging()
fun baz() {
logger.debug { "something" }
log("something")
}
}
@@ -0,0 +1,6 @@
package source;
public class Klogging {
public Logger logger = Logger();
public void log(String s) {}
}
@@ -0,0 +1,5 @@
{
"mainFile": "source/Foo.kt",
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
"targetPackage": "target"
}