Support open ranges in stdlib-gen

#KT-52932
This commit is contained in:
Ilya Gorbunov
2022-06-26 03:07:33 +03:00
committed by Space
parent cd9b36b4c3
commit 71336df50a
3 changed files with 4 additions and 2 deletions
@@ -20,6 +20,7 @@ enum class Family {
Strings,
Ranges,
RangesOfPrimitives,
OpenRanges,
ProgressionsOfPrimitives,
Generic,
Primitives,
@@ -33,7 +33,7 @@ object DocExtensions {
get() = when (this) {
CharSequences -> "char sequence"
ArraysOfObjects, ArraysOfPrimitives, InvariantArraysOfObjects, ArraysOfUnsigned -> "array"
Ranges, RangesOfPrimitives -> "range"
Ranges, RangesOfPrimitives, OpenRanges -> "range"
ProgressionsOfPrimitives -> "progression"
Strings, Sequences, Maps, Lists, Sets -> name.singularize().decapitalize()
else -> "collection"
@@ -13,7 +13,7 @@ private fun getDefaultSourceFile(f: Family): SourceFile = when (f) {
Iterables, Collections, Lists -> SourceFile.Collections
Sequences -> SourceFile.Sequences
Sets -> SourceFile.Sets
Ranges, RangesOfPrimitives, ProgressionsOfPrimitives -> SourceFile.Ranges
Ranges, OpenRanges, RangesOfPrimitives, ProgressionsOfPrimitives -> SourceFile.Ranges
ArraysOfObjects, InvariantArraysOfObjects, ArraysOfPrimitives -> SourceFile.Arrays
ArraysOfUnsigned -> SourceFile.UArrays
Maps -> SourceFile.Maps
@@ -268,6 +268,7 @@ class MemberBuilder(
Strings -> "String"
CharSequences -> "CharSequence"
Ranges -> "ClosedRange<$receiverT>"
OpenRanges -> "OpenEndRange<$receiverT>"
ArraysOfPrimitives, ArraysOfUnsigned -> primitive?.let { it.name + "Array" } ?: throw IllegalArgumentException("Primitive array should specify primitive type")
RangesOfPrimitives -> primitive?.let { it.name + "Range" } ?: throw IllegalArgumentException("Primitive range should specify primitive type")
ProgressionsOfPrimitives -> primitive?.let { it.name + "Progression" } ?: throw IllegalArgumentException("Primitive progression should specify primitive type")