I have a function
fun foo(
id: String,
vararg values: Int,
){
...
}
and there are calls like these
fun bar1(){
foo("id_1")
foo("id_2", 1)
foo("id_3", 1, 2, 3)
}
Now I've understood that I need to add one more argument to foo. but I don't want to break existing calls so I tried to add it with default values:
fun foo(
id: String,
attributes: Array<String> = arrayOf("a", "b"),
vararg values: Int,
){
...
}
But
foo("id_2", 1)
foo("id_3", 1, 2, 3)
became broken.
Is there way to add one more argument with default value without breaking existing calls ?