9b114335fb
K2 IDE Plugin uses only a partial set of built-ins. It only has declarations which are not present in the JVM stdlib as classfiles. Because of that, some major declarations like `kotlin.Unit` are missing, so resolution inside kotlin stdlib common modules does not work. Because of incorrectly resolved stdlib, highlighting and resolution in other files in the kotlin project does not work. This commit adds source versions of stdlib declarations (`/core/builtins/src/kotlin/`) to the common stdlib as a source-set for IDE import. This way all declarations in stdlib common module are properly resolved. The approach might be incorrect as it might introduce possible redeclaration conflicts between common and platform stdlib sources as `/core/builtins/src/kotlin/` source-set is also registered as a source-set for platforms.
The Kotlin Standard Library
This module creates the standard library for Kotlin.
Notes for contributors
We use code generation to generate utility extension functions for some collection-like types like arrays, strings, Collection<T>, Sequence<T>, Map<K, V> etc.
These sources are placed into the generated folder and their names are prefixed with an underscore, for example, generated/_Collections.kt
To run the code generator, use the following command in the root directory of the project:
./gradlew :tools:kotlin-stdlib-gen:run
Note: on Windows type
gradlewwithout the leading./
This then runs the script which generates a significant part of stdlib sources from the templates written in a special Kotlin-based DSL.
Usage samples
If you want to author samples for the standard library, please head to the samples readme.