kotlin-koans-edu-obsolete
kotlin-koans-edu-obsolete copied to clipboard
Java to Kotlin conversion test fails
For this step: https://github.com/Kotlin/kotlin-koans-edu/tree/master/Kotlin%20Koans/Introduction/Java%20to%20Kotlin%20conversion
Copying the Java Class code:
public class JavaCode { public String toJSON(Collection<Integer> collection) { ....... } }
Produces Kotlin code:
class JavaCode { fun toJSON(collection:Collection<Int>):String { ........ } }
Which fails the test with "Error:(7, 80) Unresolved reference: toJSON":
Assert.assertEquals("toJSON".toMessageInEquals(), "[1, 2, 3, 42, 555]", toJSON(listOf(1, 2, 3, 42, 555)))
I ran into this too. The fix suggested in the PR worked for me 🤔
Seems like maybe the koan is assuming that the code converter will create a top-level function, instead of a class method?