Recompile files which import companion constant
#KT-44741 Fixed
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
companion object {
|
||||
const val CONSTANT_VALUE = 16
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
class A {
|
||||
companion object {
|
||||
const val CONSTANT_VALUE = 17
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package foo
|
||||
|
||||
import test.A.Companion.CONSTANT_VALUE
|
||||
|
||||
class B {
|
||||
companion object {
|
||||
fun main() {
|
||||
println("Import companion constant: ${CONSTANT_VALUE}")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package foo
|
||||
|
||||
import test.A
|
||||
|
||||
class C {
|
||||
companion object {
|
||||
fun main() {
|
||||
println("Companion constant: ${A.CONSTANT_VALUE}")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package foo
|
||||
|
||||
class DoNotUseConstant {
|
||||
companion object {
|
||||
const val CONSTANT_VALUE = 10
|
||||
fun main() {
|
||||
println("Use local constant: ${CONSTANT_VALUE}")
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
================ Step #1 =================
|
||||
|
||||
Compiling files:
|
||||
src/A.kt
|
||||
src/B.kt
|
||||
src/C.kt
|
||||
src/companionUsage.kt
|
||||
src/constantUsage.kt
|
||||
End of files
|
||||
Exit code: OK
|
||||
------------------------------------------
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package foo
|
||||
|
||||
import test.A
|
||||
|
||||
fun callCompanionConstant() = "Companion constant: ${A.CONSTANT_VALUE}"
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package foo
|
||||
|
||||
import test.A.Companion.CONSTANT_VALUE
|
||||
|
||||
fun importCompanionConstant() = "Import companion constant: ${CONSTANT_VALUE}"
|
||||
|
||||
Reference in New Issue
Block a user