Recently I encountered such a problem. Imagine we have a function like follow:
fun prepareRequest(alias: String): JsonObject {
return json {
"alias" to alias
}
}
Then I did small refactoring:
fun prepareRequest(alias: Alias): JsonObject {
return json {
"alias" to alias
// Fix:
// "alias" to alias.name
}
}
And suddenly method to became https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/to.html which result is just lost. The compiler is silent.
Possibly it is worth to rename JsonObjectBuilder.to extension method or make json object construction more explicit.