https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
m

Marc Knaup

05/08/2019, 1:40 PM
Why is a different extension function called depending on whether one is
expect
or not? common module:
Copy code
sealed class Test {
	object A : Test()
}
If I don't use `expect`:
Copy code
fun Test.print() {
	when (this) {
		is Test.A -> print() // calls method below
	}
}

fun Test.A.print() { // gets called
	println("A")
}
If I use `expect`:
Copy code
fun Test.print() {
	when (this) {
		is Test.A -> print() // recursive call
	}
}

expect fun Test.A.print() // not called
l

louiscad

05/08/2019, 2:16 PM
That seems to be a problem in ambiguity resolution. Could you report it ln kotl.in/issue and link it back here?
m