Browsing source code of kotlin.kotlin_builtins like the .. operator


#1

I’m always interested in understanding how things a working especially within the Kotlin Standard Library to grasp a better and more complete understanding of the language and its properties.

In IDEA / Android Studio I can navigate i.e. to methods Iterable.flatMap(), but clicking on a .. operator leads me to a generated stub file without any code. Also I do not have any KDoc on these elements.

Are these methods not backed with implementation code?


#2

Currently, navigation to builtin sources may not work as expected in maven/gradle projects.

You can find sources of builtins here https://github.com/JetBrains/kotlin/tree/master/core/builtins.
Note that the ‘native’ part of them do not have implementation bodies, as they are implemented as compiler intrinsics.

If you’re more interested in what they are compiled to, you can inspect the generated bytecode with the “Show Kotlin bytecode” action.


#3

Thanks @ilya.gorbunov. Great answer which leaves none of my questions open!