class Example
fun main(){
val example: Example = Example()
// what function i am calling is it fun Example.extensionFun() ?
// Or is it Example.extensionFun(string: String) ?
example.extensionFun()
}
// first extension function
fun Example.extensionFun(){
println("Hey i'm first extension function")
}
// second extension function
fun Example.extensionFun(testArgument: String = "test argument "){ // argument just to change the function signature
println("Hey i'm second extension function ")
}
In the above example i have created two extension function with the same name but different signature. When i try to call ->
example.extensionFun()
then IDE just calls the "fun Example.extensionFun()"
but even if i try to call
fun Example.extensionFun(testArgument: String ="test argument")
by using code completion pop up and selecting second extension function it is again calling
fun Example.extensionFun()
and thus it left me single way to call the second extension function which is by passing the different value for the testArgumet (argument). for eg.
example.extensionFun("different value")
but there is many cases where we don't want to change the default value of the function parameter when we are calling it.
I think i found a bug but kindly please share your opinion