Make NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION error

Original commit: de5dc61820
This commit is contained in:
Zalim Bashorov
2015-10-16 15:07:31 +03:00
parent 9f2f66b3b8
commit 86acb982e5
20 changed files with 68 additions and 48 deletions
@@ -87,6 +87,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
override fun getCompilableFileExtensions() = arrayListOf("kt")
override fun buildStarted(context: CompileContext) {
LOG.debug("==========================================")
LOG.info("is Kotlin incremental compilation enabled: ${IncrementalCompilation.isEnabled()}")
val historyLabel = context.getBuilderParameter("history label")
@@ -101,6 +102,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
dirtyFilesHolder: DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget>,
outputConsumer: ModuleLevelBuilder.OutputConsumer
): ModuleLevelBuilder.ExitCode {
LOG.debug("------------------------------------------")
val messageCollector = MessageCollectorAdapter(context)
try {
@@ -213,7 +215,9 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
copyJsLibraryFilesIfNeeded(chunk, project)
}
if (!IncrementalCompilation.isEnabled()) return OK
if (!IncrementalCompilation.isEnabled()) {
return OK
}
val caches = filesToCompile.keySet().map { incrementalCaches[it]!! }
val marker = ChangesProcessor(context, chunk, allCompiledFiles, caches)
@@ -7,8 +7,16 @@ Compiling files:
module1/src/module1_const.kt
End of files
Cleaning output files:
out/production/module1/META-INF/module1.kotlin_module
out/production/module1/test/Module1_constKt.class
out/production/module1/test/TestPackage.class
End of files
Compiling files:
module1/src/module1_const.kt
End of files
Cleaning output files:
out/production/module2/usage/Usage.class
End of files
Compiling files:
module2/src/module2_usage.kt
End of files
End of files
@@ -1,3 +1,3 @@
package test
public val CONST: String = "BF"
public const val CONST: String = "BF"
@@ -1,3 +1,3 @@
package test
public val CONST: String = "Ae"
public const val CONST: String = "Ae"
@@ -17,8 +17,12 @@ Compiling files:
src/const.kt
End of files
Cleaning output files:
out/production/module/META-INF/module.kotlin_module
out/production/module/test/ConstKt.class
out/production/module/test/TestPackage.class
out/production/module/test/Usage.class
End of files
Compiling files:
src/const.kt
src/usage.kt
End of files
End of files
@@ -1,12 +1,12 @@
package test
val b: Byte = 100
val s: Short = 20000
val i: Int = 2000000
val l: Long = 2000000000000L
val f: Float = 3.14f
val d: Double = 3.14
val bb: Boolean = true
val c: Char = '\u03c0' // pi symbol
const val b: Byte = 100
const val s: Short = 20000
const val i: Int = 2000000
const val l: Long = 2000000000000L
const val f: Float = 3.14f
const val d: Double = 3.14
const val bb: Boolean = true
const val c: Char = '\u03c0' // pi symbol
val str: String = ":)"
const val str: String = ":)"
@@ -1,12 +1,12 @@
package test
val b: Byte = 50 + 50
val s: Short = 10000 + 10000
val i: Int = 1000000 + 1000000
val l: Long = 1000000000000L + 1000000000000L
val f: Float = 0.0f + 3.14f
val d: Double = 0.0 + 3.14
val bb: Boolean = !false
val c: Char = '\u03c0' // pi symbol
const val b: Byte = 50 + 50
const val s: Short = 10000 + 10000
const val i: Int = 1000000 + 1000000
const val l: Long = 1000000000000L + 1000000000000L
const val f: Float = 0.0f + 3.14f
const val d: Double = 0.0 + 3.14
const val bb: Boolean = !false
const val c: Char = '\u03c0' // pi symbol
val str: String = ":)"
const val str: String = ":)"
@@ -1,12 +1,12 @@
package test
val b: Byte = 0
val s: Short = 0
val i: Int = 0
val l: Long = 0
val f: Float = 0.0f
val d: Double = 0.0
val bb: Boolean = false
val c: Char = 'x'
const val b: Byte = 0
const val s: Short = 0
const val i: Int = 0
const val l: Long = 0
const val f: Float = 0.0f
const val d: Double = 0.0
const val bb: Boolean = false
const val c: Char = 'x'
val str: String = ":("
const val str: String = ":("
@@ -3,6 +3,6 @@ package test
class Klass {
companion object {
// Old and new constant values are different, but their hashes are the same
val CONST = "BF"
const val CONST = "BF"
}
}
@@ -3,6 +3,6 @@ package test
class Klass {
companion object {
// Old and new constant values are different, but their hashes are the same
val CONST = "Ae"
const val CONST = "Ae"
}
}
@@ -1,9 +1,9 @@
package test
val CONST = "foo"
const val CONST = "foo"
class Klass {
companion object {
val CONST = "bar"
const val CONST = "bar"
}
}
@@ -1,9 +1,9 @@
package test
val CONST = "foo"
const val CONST = "foo"
class Klass {
companion object {
val CONST = "bar"
const val CONST = "bar"
}
}
@@ -1,3 +1,3 @@
package test
val CONST = "foo"
const val CONST = "foo"
@@ -1,5 +1,5 @@
package test
object Object {
val CONST = "old"
const val CONST = "old"
}
@@ -1,5 +1,5 @@
package test
object Object {
val CONST = "new"
const val CONST = "new"
}
@@ -7,8 +7,12 @@ Compiling files:
src/const.kt
End of files
Cleaning output files:
out/production/module/META-INF/module.kotlin_module
out/production/module/test/ConstKt.class
out/production/module/test/TestPackage.class
out/production/module/test/Usage.class
End of files
Compiling files:
src/const.kt
src/usage.kt
End of files
End of files
@@ -1,4 +1,4 @@
package test
// Old and new constant values are different, but their hashes are the same
val CONST = "BF"
const val CONST = "BF"
@@ -1,4 +1,4 @@
package test
// Old and new constant values are different, but their hashes are the same
val CONST = "Ae"
const val CONST = "Ae"
@@ -1,11 +1,11 @@
package test
val CONST = "foo"
const val CONST = "foo"
class Klass {
companion object {
private val CHANGED = "old"
public val UNCHANGED = 100
const public val UNCHANGED = 100
}
}
@@ -1,11 +1,11 @@
package test
val CONST = "foo"
const val CONST = "foo"
class Klass {
companion object {
private val CHANGED = "new"
public val UNCHANGED = 100
const public val UNCHANGED = 100
}
}