Render contracts in kotlinp, fix minor bug in kotlinx-metadata-jvm

This commit is contained in:
Alexander Udalov
2019-05-07 15:04:00 +02:00
parent 2a3786e3f8
commit fd00999771
6 changed files with 280 additions and 3 deletions
@@ -5,6 +5,7 @@
- [`KT-31308`](https://youtrack.jetbrains.com/issue/KT-31308) Add module name extensions to kotlinx-metadata-jvm
- [`KT-31338`](https://youtrack.jetbrains.com/issue/KT-31338) Retain "is moved from interface companion" property flag in kotlinx-metadata-jvm
- Breaking change: JvmPropertyExtensionVisitor.visit has a new parameter `jvmFlags: Flags`
- Correctly write "null" constant value in effect expression of a contract
- Rename `desc` parameters to `signature` in JvmFunctionExtensionVisitor, JvmPropertyExtensionVisitor, JvmConstructorExtensionVisitor
## 0.0.5
@@ -384,11 +384,10 @@ private fun writeEffectExpression(c: WriteContext, output: (ProtoBuf.Expression.
}
override fun visitConstantValue(value: Any?) {
@Suppress("UNUSED_VARIABLE") // force exhaustive when
val unused = when (value) {
when (value) {
true -> t.constantValue = ProtoBuf.Expression.ConstantValue.TRUE
false -> t.constantValue = ProtoBuf.Expression.ConstantValue.FALSE
null -> null
null -> t.constantValue = ProtoBuf.Expression.ConstantValue.NULL
else -> throw IllegalArgumentException("Only true, false or null constant values are allowed for effects (was=$value)")
}
}