Deprecate meaningless or vague-defined operations with Char operands: downTo.

This commit is contained in:
Ilya Gorbunov
2015-05-29 23:47:05 +03:00
parent 8a751ad74a
commit 64b2e37436
2 changed files with 20 additions and 2 deletions
@@ -31,15 +31,21 @@ private fun generateDownTos(outputFile: File, header: String) {
else -> "-1"
}
val deprecated =
if ((fromType == "Char") != (toType == "Char")) {
"""deprecated("This operation doesn't make sense and shall be removed in M13. Consider converting Char operand to Int or other operand to Char.")"""
} else ""
writer.println("""
/**
* Returns a progression from this value down to the specified [to] value.
*
* The [to] value has to be less than this value.
*/
$deprecated
public fun $fromType.downTo(to: $toType): $progressionType {
return $progressionType($fromExpr, $toExpr, $incrementExpr)
}""")
}""".replace("\n\n","\n"))
}
println("Writing $outputFile")
@@ -53,7 +59,7 @@ public fun $fromType.downTo(to: $toType): $progressionType {
$COMMON_AUTOGENERATED_WARNING
""")
val types = array("Byte", "Char", "Short", "Int", "Long", "Float", "Double")
val types = arrayOf("Byte", "Char", "Short", "Int", "Long", "Float", "Double")
for (fromType in types) {
for (toType in types) {
generateDownTo(writer, fromType, toType)