From de5dc61820443cb804f82957af50c66c1c59039a Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 16 Oct 2015 15:07:31 +0300 Subject: [PATCH] Make NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION error --- .../jetbrains/kotlin/diagnostics/Errors.java | 2 +- ...otlinPropertyFromClassObjectAsParameter.kt | 18 +++++----- .../kotlinTopLevelPropertyAsParameter.kt | 18 +++++----- .../nestedClassPropertyAsParameter.kt | 2 +- ...rtyWithPropertyInInitializerAsParameter.kt | 4 +-- .../evaluate/simpleCallBinary.kt | 10 +++--- .../boxWithStdlib/evaluate/unaryMinus.kt | 14 ++++---- .../boxWithStdlib/evaluate/unaryPlus.kt | 14 ++++---- .../InlinedConstants.A.kt | 20 +++++------ .../KotlinPropertyAsAnnotationParameter.A.kt | 36 +++++++++---------- .../quickfix/modifiers/constVal.after.kt | 2 ++ .../modifiers/constVal.before.Main.kt | 2 ++ .../kotlin/jps/build/KotlinBuilder.kt | 6 +++- .../constantValueChanged/build.log | 10 +++++- .../constantValueChanged/module1_const.kt | 2 +- .../constantValueChanged/module1_const.kt.new | 2 +- .../pureKotlin/allConstants/build.log | 6 +++- .../pureKotlin/allConstants/const.kt | 18 +++++----- .../pureKotlin/allConstants/const.kt.new.1 | 18 +++++----- .../pureKotlin/allConstants/const.kt.new.2 | 18 +++++----- .../classObjectConstantChanged/const.kt | 2 +- .../classObjectConstantChanged/const.kt.new | 2 +- .../pureKotlin/constantsUnchanged/const.kt | 4 +-- .../constantsUnchanged/const.kt.new | 4 +-- .../fileWithConstantRemoved/const.kt | 2 +- .../pureKotlin/objectConstantChanged/const.kt | 2 +- .../objectConstantChanged/const.kt.new | 2 +- .../packageConstantChanged/build.log | 6 +++- .../packageConstantChanged/const.kt | 2 +- .../packageConstantChanged/const.kt.new | 2 +- .../privateConstantsChanged/const.kt | 4 +-- .../privateConstantsChanged/const.kt.new | 4 +-- ...closureThisByUsingMethodFromParentClass.kt | 8 ++--- 33 files changed, 145 insertions(+), 121 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 0403fac5c76..bff465edb6b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -152,7 +152,7 @@ public interface Errors { DiagnosticFactory0 CONST_VAL_WITHOUT_INITIALIZER = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 CONST_VAL_WITH_NON_CONST_INITIALIZER = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION = DiagnosticFactory0.create(WARNING); + DiagnosticFactory0 NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION = DiagnosticFactory0.create(ERROR); DiagnosticFactory1 INAPPLICABLE_TARGET_ON_PROPERTY = DiagnosticFactory1.create(ERROR); DiagnosticFactory0 INAPPLICABLE_FIELD_TARGET_NO_BACKING_FIELD = DiagnosticFactory0.create(ERROR); diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/kotlinPropertyFromClassObjectAsParameter.kt b/compiler/testData/codegen/boxWithStdlib/annotations/kotlinPropertyFromClassObjectAsParameter.kt index 3c573bdfd83..9f011149920 100644 --- a/compiler/testData/codegen/boxWithStdlib/annotations/kotlinPropertyFromClassObjectAsParameter.kt +++ b/compiler/testData/codegen/boxWithStdlib/annotations/kotlinPropertyFromClassObjectAsParameter.kt @@ -30,14 +30,14 @@ annotation class Ann( class Foo { companion object { - val i: Int = 2 - val s: Short = 2 - val f: Float = 2.0.toFloat() - val d: Double = 2.0 - val l: Long = 2 - val b: Byte = 2 - val bool: Boolean = true - val c: Char = 'c' - val str: String = "str" + const val i: Int = 2 + const val s: Short = 2 + const val f: Float = 2.0.toFloat() + const val d: Double = 2.0 + const val l: Long = 2 + const val b: Byte = 2 + const val bool: Boolean = true + const val c: Char = 'c' + const val str: String = "str" } } diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/kotlinTopLevelPropertyAsParameter.kt b/compiler/testData/codegen/boxWithStdlib/annotations/kotlinTopLevelPropertyAsParameter.kt index 71e312709a1..a8b07064d45 100644 --- a/compiler/testData/codegen/boxWithStdlib/annotations/kotlinTopLevelPropertyAsParameter.kt +++ b/compiler/testData/codegen/boxWithStdlib/annotations/kotlinTopLevelPropertyAsParameter.kt @@ -28,12 +28,12 @@ annotation class Ann( val str: String ) -val i: Int = 2 -val s: Short = 2 -val f: Float = 2.0.toFloat() -val d: Double = 2.0 -val l: Long = 2 -val b: Byte = 2 -val bool: Boolean = true -val c: Char = 'c' -val str: String = "str" \ No newline at end of file +const val i: Int = 2 +const val s: Short = 2 +const val f: Float = 2.0.toFloat() +const val d: Double = 2.0 +const val l: Long = 2 +const val b: Byte = 2 +const val bool: Boolean = true +const val c: Char = 'c' +const val str: String = "str" diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/nestedClassPropertyAsParameter.kt b/compiler/testData/codegen/boxWithStdlib/annotations/nestedClassPropertyAsParameter.kt index 92902fa275c..718003b61ae 100644 --- a/compiler/testData/codegen/boxWithStdlib/annotations/nestedClassPropertyAsParameter.kt +++ b/compiler/testData/codegen/boxWithStdlib/annotations/nestedClassPropertyAsParameter.kt @@ -13,7 +13,7 @@ annotation class Ann(val i: Int) class A { class B { companion object { - val i = 1 + const val i = 1 } } } diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/propertyWithPropertyInInitializerAsParameter.kt b/compiler/testData/codegen/boxWithStdlib/annotations/propertyWithPropertyInInitializerAsParameter.kt index e36875b6351..1cb0d6cbb82 100644 --- a/compiler/testData/codegen/boxWithStdlib/annotations/propertyWithPropertyInInitializerAsParameter.kt +++ b/compiler/testData/codegen/boxWithStdlib/annotations/propertyWithPropertyInInitializerAsParameter.kt @@ -10,5 +10,5 @@ fun box(): String { @Retention(AnnotationRetention.RUNTIME) annotation class Ann(val i: Int) -val i2: Int = 1 -val i: Int = i2 +const val i2: Int = 1 +const val i: Int = i2 diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/simpleCallBinary.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/simpleCallBinary.kt index 76e05e967bf..f8e2fea09e4 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/simpleCallBinary.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/simpleCallBinary.kt @@ -7,11 +7,11 @@ annotation class Ann( val p5: Int ) -val prop1: Int = 1.plus(1) -val prop2: Int = 1.minus(1) -val prop3: Int = 1.times(1) -val prop4: Int = 1.div(1) -val prop5: Int = 1.mod(1) +const val prop1: Int = 1.plus(1) +const val prop2: Int = 1.minus(1) +const val prop3: Int = 1.times(1) +const val prop4: Int = 1.div(1) +const val prop5: Int = 1.mod(1) @Ann(prop1, prop2, prop3, prop4, prop5) class MyClass diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/unaryMinus.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/unaryMinus.kt index 71677bb9048..7ccb19591e6 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/unaryMinus.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/unaryMinus.kt @@ -8,12 +8,12 @@ annotation class Ann( val p6: Float ) -val prop1: Byte = -1 -val prop2: Short = -1 -val prop3: Int = -1 -val prop4: Long = -1 -val prop5: Double = -1.0 -val prop6: Float = -1.0.toFloat() +const val prop1: Byte = -1 +const val prop2: Short = -1 +const val prop3: Int = -1 +const val prop4: Long = -1 +const val prop5: Double = -1.0 +const val prop6: Float = -1.0.toFloat() @Ann(prop1, prop2, prop3, prop4, prop5, prop6) class MyClass @@ -26,4 +26,4 @@ fun box(): String { if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/unaryPlus.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/unaryPlus.kt index 63c80f14565..a02b291a5dd 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/unaryPlus.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/unaryPlus.kt @@ -8,12 +8,12 @@ annotation class Ann( val p6: Float ) -val prop1: Byte = +1 -val prop2: Short = +1 -val prop3: Int = +1 -val prop4: Long = +1 -val prop5: Double = +1.0 -val prop6: Float = +1.0.toFloat() +const val prop1: Byte = +1 +const val prop2: Short = +1 +const val prop3: Int = +1 +const val prop4: Long = +1 +const val prop5: Double = +1.0 +const val prop6: Float = +1.0.toFloat() @Ann(prop1, prop2, prop3, prop4, prop5, prop6) class MyClass @@ -26,4 +26,4 @@ fun box(): String { if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/compileKotlinAgainstKotlin/InlinedConstants.A.kt b/compiler/testData/compileKotlinAgainstKotlin/InlinedConstants.A.kt index 19a48ee856f..f8b06ffd526 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/InlinedConstants.A.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/InlinedConstants.A.kt @@ -1,15 +1,15 @@ package constants -public val b: Byte = 100 -public val s: Short = 20000 -public val i: Int = 2000000 -public val l: Long = 2000000000000L -public val f: Float = 3.14f -public val d: Double = 3.14 -public val bb: Boolean = true -public val c: Char = '\u03c0' // pi symbol +public const val b: Byte = 100 +public const val s: Short = 20000 +public const val i: Int = 2000000 +public const val l: Long = 2000000000000L +public const val f: Float = 3.14f +public const val d: Double = 3.14 +public const val bb: Boolean = true +public const val c: Char = '\u03c0' // pi symbol -public val str: String = ":)" +public const val str: String = ":)" @Retention(AnnotationRetention.RUNTIME) -public annotation class AnnotationClass(public val value: String) \ No newline at end of file +public annotation class AnnotationClass(public val value: String) diff --git a/compiler/testData/compileKotlinAgainstKotlin/KotlinPropertyAsAnnotationParameter.A.kt b/compiler/testData/compileKotlinAgainstKotlin/KotlinPropertyAsAnnotationParameter.A.kt index 5200f1254b2..19d8fffa821 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/KotlinPropertyAsAnnotationParameter.A.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/KotlinPropertyAsAnnotationParameter.A.kt @@ -1,21 +1,21 @@ package a -val i = 2 -val s = 2.toShort() -val f = 2.0.toFloat() -val d = 2.0 -val l = 2L -val b = 2.toByte() -val bool = true -val c = 'c' -val str = "str" +const val i = 2 +const val s = 2.toShort() +const val f = 2.0.toFloat() +const val d = 2.0 +const val l = 2L +const val b = 2.toByte() +const val bool = true +const val c = 'c' +const val str = "str" -val i2 = i -val s2 = s -val f2 = f -val d2 = d -val l2 = l -val b2 = b -val bool2 = bool -val c2 = c -val str2 = str \ No newline at end of file +const val i2 = i +const val s2 = s +const val f2 = f +const val d2 = d +const val l2 = l +const val b2 = b +const val bool2 = bool +const val c2 = c +const val str2 = str diff --git a/idea/testData/quickfix/modifiers/constVal.after.kt b/idea/testData/quickfix/modifiers/constVal.after.kt index 6aaae6e6124..51a147a3402 100644 --- a/idea/testData/quickfix/modifiers/constVal.after.kt +++ b/idea/testData/quickfix/modifiers/constVal.after.kt @@ -1,4 +1,6 @@ // "Add 'const' modifier" "true" +// ERROR: Only 'const val' can be used in constant expressions + package constVal const val i = 1 diff --git a/idea/testData/quickfix/modifiers/constVal.before.Main.kt b/idea/testData/quickfix/modifiers/constVal.before.Main.kt index 56bfdabe8b7..14e16dd2a30 100644 --- a/idea/testData/quickfix/modifiers/constVal.before.Main.kt +++ b/idea/testData/quickfix/modifiers/constVal.before.Main.kt @@ -1,4 +1,6 @@ // "Add 'const' modifier" "true" +// ERROR: Only 'const val' can be used in constant expressions + package constVal val i = 1 diff --git a/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt b/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt index e7d99df6db9..5aceafc6d9e 100644 --- a/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt +++ b/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt @@ -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, 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) diff --git a/jps-plugin/testData/incremental/multiModule/constantValueChanged/build.log b/jps-plugin/testData/incremental/multiModule/constantValueChanged/build.log index 1b7e8ed2b89..0a36e429697 100644 --- a/jps-plugin/testData/incremental/multiModule/constantValueChanged/build.log +++ b/jps-plugin/testData/incremental/multiModule/constantValueChanged/build.log @@ -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 \ No newline at end of file +End of files diff --git a/jps-plugin/testData/incremental/multiModule/constantValueChanged/module1_const.kt b/jps-plugin/testData/incremental/multiModule/constantValueChanged/module1_const.kt index e79d6d05129..3b7db43d11b 100644 --- a/jps-plugin/testData/incremental/multiModule/constantValueChanged/module1_const.kt +++ b/jps-plugin/testData/incremental/multiModule/constantValueChanged/module1_const.kt @@ -1,3 +1,3 @@ package test -public val CONST: String = "BF" +public const val CONST: String = "BF" diff --git a/jps-plugin/testData/incremental/multiModule/constantValueChanged/module1_const.kt.new b/jps-plugin/testData/incremental/multiModule/constantValueChanged/module1_const.kt.new index d6250846ebf..06509478371 100644 --- a/jps-plugin/testData/incremental/multiModule/constantValueChanged/module1_const.kt.new +++ b/jps-plugin/testData/incremental/multiModule/constantValueChanged/module1_const.kt.new @@ -1,3 +1,3 @@ package test -public val CONST: String = "Ae" +public const val CONST: String = "Ae" diff --git a/jps-plugin/testData/incremental/pureKotlin/allConstants/build.log b/jps-plugin/testData/incremental/pureKotlin/allConstants/build.log index 95a68077542..d7f5b678069 100644 --- a/jps-plugin/testData/incremental/pureKotlin/allConstants/build.log +++ b/jps-plugin/testData/incremental/pureKotlin/allConstants/build.log @@ -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 \ No newline at end of file +End of files diff --git a/jps-plugin/testData/incremental/pureKotlin/allConstants/const.kt b/jps-plugin/testData/incremental/pureKotlin/allConstants/const.kt index d0d300c1312..73047748dac 100644 --- a/jps-plugin/testData/incremental/pureKotlin/allConstants/const.kt +++ b/jps-plugin/testData/incremental/pureKotlin/allConstants/const.kt @@ -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 = ":)" diff --git a/jps-plugin/testData/incremental/pureKotlin/allConstants/const.kt.new.1 b/jps-plugin/testData/incremental/pureKotlin/allConstants/const.kt.new.1 index 26796869ddc..9fe38e75928 100644 --- a/jps-plugin/testData/incremental/pureKotlin/allConstants/const.kt.new.1 +++ b/jps-plugin/testData/incremental/pureKotlin/allConstants/const.kt.new.1 @@ -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 = ":)" diff --git a/jps-plugin/testData/incremental/pureKotlin/allConstants/const.kt.new.2 b/jps-plugin/testData/incremental/pureKotlin/allConstants/const.kt.new.2 index 668b4009dce..d0df4060261 100644 --- a/jps-plugin/testData/incremental/pureKotlin/allConstants/const.kt.new.2 +++ b/jps-plugin/testData/incremental/pureKotlin/allConstants/const.kt.new.2 @@ -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 = ":(" diff --git a/jps-plugin/testData/incremental/pureKotlin/classObjectConstantChanged/const.kt b/jps-plugin/testData/incremental/pureKotlin/classObjectConstantChanged/const.kt index 4680ae2c26f..cd3256a7612 100644 --- a/jps-plugin/testData/incremental/pureKotlin/classObjectConstantChanged/const.kt +++ b/jps-plugin/testData/incremental/pureKotlin/classObjectConstantChanged/const.kt @@ -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" } } diff --git a/jps-plugin/testData/incremental/pureKotlin/classObjectConstantChanged/const.kt.new b/jps-plugin/testData/incremental/pureKotlin/classObjectConstantChanged/const.kt.new index e9ccf1ab8db..49b604cd74f 100644 --- a/jps-plugin/testData/incremental/pureKotlin/classObjectConstantChanged/const.kt.new +++ b/jps-plugin/testData/incremental/pureKotlin/classObjectConstantChanged/const.kt.new @@ -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" } } diff --git a/jps-plugin/testData/incremental/pureKotlin/constantsUnchanged/const.kt b/jps-plugin/testData/incremental/pureKotlin/constantsUnchanged/const.kt index 40bbe8de705..8bdd5ae5b5d 100644 --- a/jps-plugin/testData/incremental/pureKotlin/constantsUnchanged/const.kt +++ b/jps-plugin/testData/incremental/pureKotlin/constantsUnchanged/const.kt @@ -1,9 +1,9 @@ package test -val CONST = "foo" +const val CONST = "foo" class Klass { companion object { - val CONST = "bar" + const val CONST = "bar" } } diff --git a/jps-plugin/testData/incremental/pureKotlin/constantsUnchanged/const.kt.new b/jps-plugin/testData/incremental/pureKotlin/constantsUnchanged/const.kt.new index 40bbe8de705..8bdd5ae5b5d 100644 --- a/jps-plugin/testData/incremental/pureKotlin/constantsUnchanged/const.kt.new +++ b/jps-plugin/testData/incremental/pureKotlin/constantsUnchanged/const.kt.new @@ -1,9 +1,9 @@ package test -val CONST = "foo" +const val CONST = "foo" class Klass { companion object { - val CONST = "bar" + const val CONST = "bar" } } diff --git a/jps-plugin/testData/incremental/pureKotlin/fileWithConstantRemoved/const.kt b/jps-plugin/testData/incremental/pureKotlin/fileWithConstantRemoved/const.kt index 1572968f89f..c2cc75a6691 100644 --- a/jps-plugin/testData/incremental/pureKotlin/fileWithConstantRemoved/const.kt +++ b/jps-plugin/testData/incremental/pureKotlin/fileWithConstantRemoved/const.kt @@ -1,3 +1,3 @@ package test -val CONST = "foo" +const val CONST = "foo" diff --git a/jps-plugin/testData/incremental/pureKotlin/objectConstantChanged/const.kt b/jps-plugin/testData/incremental/pureKotlin/objectConstantChanged/const.kt index 13a01eb1ac1..18ba78875d7 100644 --- a/jps-plugin/testData/incremental/pureKotlin/objectConstantChanged/const.kt +++ b/jps-plugin/testData/incremental/pureKotlin/objectConstantChanged/const.kt @@ -1,5 +1,5 @@ package test object Object { - val CONST = "old" + const val CONST = "old" } diff --git a/jps-plugin/testData/incremental/pureKotlin/objectConstantChanged/const.kt.new b/jps-plugin/testData/incremental/pureKotlin/objectConstantChanged/const.kt.new index d604ca1244f..3c94cbcc28b 100644 --- a/jps-plugin/testData/incremental/pureKotlin/objectConstantChanged/const.kt.new +++ b/jps-plugin/testData/incremental/pureKotlin/objectConstantChanged/const.kt.new @@ -1,5 +1,5 @@ package test object Object { - val CONST = "new" + const val CONST = "new" } diff --git a/jps-plugin/testData/incremental/pureKotlin/packageConstantChanged/build.log b/jps-plugin/testData/incremental/pureKotlin/packageConstantChanged/build.log index ff943c45dd4..3e12fb327e1 100644 --- a/jps-plugin/testData/incremental/pureKotlin/packageConstantChanged/build.log +++ b/jps-plugin/testData/incremental/pureKotlin/packageConstantChanged/build.log @@ -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 \ No newline at end of file +End of files diff --git a/jps-plugin/testData/incremental/pureKotlin/packageConstantChanged/const.kt b/jps-plugin/testData/incremental/pureKotlin/packageConstantChanged/const.kt index 62b4a2d0b23..cbc9ae86717 100644 --- a/jps-plugin/testData/incremental/pureKotlin/packageConstantChanged/const.kt +++ b/jps-plugin/testData/incremental/pureKotlin/packageConstantChanged/const.kt @@ -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" diff --git a/jps-plugin/testData/incremental/pureKotlin/packageConstantChanged/const.kt.new b/jps-plugin/testData/incremental/pureKotlin/packageConstantChanged/const.kt.new index bf471bbe0da..5d4d205f5a1 100644 --- a/jps-plugin/testData/incremental/pureKotlin/packageConstantChanged/const.kt.new +++ b/jps-plugin/testData/incremental/pureKotlin/packageConstantChanged/const.kt.new @@ -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" diff --git a/jps-plugin/testData/incremental/pureKotlin/privateConstantsChanged/const.kt b/jps-plugin/testData/incremental/pureKotlin/privateConstantsChanged/const.kt index 7f64be02734..9ab04e28aff 100644 --- a/jps-plugin/testData/incremental/pureKotlin/privateConstantsChanged/const.kt +++ b/jps-plugin/testData/incremental/pureKotlin/privateConstantsChanged/const.kt @@ -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 } } diff --git a/jps-plugin/testData/incremental/pureKotlin/privateConstantsChanged/const.kt.new b/jps-plugin/testData/incremental/pureKotlin/privateConstantsChanged/const.kt.new index 569acca03d0..83f620f0760 100644 --- a/jps-plugin/testData/incremental/pureKotlin/privateConstantsChanged/const.kt.new +++ b/jps-plugin/testData/incremental/pureKotlin/privateConstantsChanged/const.kt.new @@ -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 } } diff --git a/js/js.translator/testData/closure/cases/closureThisByUsingMethodFromParentClass.kt b/js/js.translator/testData/closure/cases/closureThisByUsingMethodFromParentClass.kt index f8d7ddd32c5..eaf2d77d884 100644 --- a/js/js.translator/testData/closure/cases/closureThisByUsingMethodFromParentClass.kt +++ b/js/js.translator/testData/closure/cases/closureThisByUsingMethodFromParentClass.kt @@ -3,11 +3,11 @@ package foo // HACKS @native -val ROOT = "Kotlin.modules.JS_TESTS" +const val ROOT = "Kotlin.modules.JS_TESTS" @native -val PATH_TO_F_CREATOR = "foo.B.far\$f" +const val PATH_TO_F_CREATOR = "foo.B.far\$f" @native -val PATH_TO_G_CREATOR = "foo.B.gar\$f" +const val PATH_TO_G_CREATOR = "foo.B.gar\$f" @native("$ROOT.$PATH_TO_F_CREATOR") val F_CREATOR: Any = noImpl @@ -54,4 +54,4 @@ fun String.replace(regexp: RegExp, replacement: String): String = noImpl fun String.replaceAll(regexp: String, replacement: String): String = replace(RegExp(regexp, "g"), replacement) @native -class RegExp(regexp: String, flags: String) \ No newline at end of file +class RegExp(regexp: String, flags: String)