Common stdlib
- adds actual matching expect declarations - removes duplicates - rewrite collections - add MPP and experimental compiler options
This commit is contained in:
committed by
Pavel Punegov
parent
c807fca8cb
commit
374397d03f
@@ -182,6 +182,9 @@ targetList.each { target ->
|
||||
args = [*konanArgs,
|
||||
'-output', project(':runtime').file("build/${target}Stdlib"),
|
||||
'-produce', 'library', '-module_name', 'stdlib',
|
||||
'-Xmulti-platform', '-Xuse-experimental=kotlin.Experimental',
|
||||
rootProject.file('libraries/generated'),
|
||||
rootProject.file('libraries'),
|
||||
project(':Interop:Runtime').file('src/main/kotlin'),
|
||||
project(':Interop:Runtime').file('src/native/kotlin'),
|
||||
project(':Interop:JsRuntime').file('src/main/kotlin'),
|
||||
@@ -190,6 +193,8 @@ targetList.each { target ->
|
||||
inputs.dir(project(':Interop:Runtime').file('src/main/kotlin'))
|
||||
inputs.dir(project(':Interop:Runtime').file('src/native/kotlin'))
|
||||
inputs.dir(project(':Interop:JsRuntime').file('src/main/kotlin'))
|
||||
inputs.dir(rootProject.file('libraries/generated'))
|
||||
inputs.dir(rootProject.file('libraries/kotlin'))
|
||||
outputs.dir(project(':runtime').file("build/${target}Stdlib"))
|
||||
|
||||
dependsOn ":runtime:${target}Runtime"
|
||||
|
||||
+14
-2
@@ -219,8 +219,20 @@ internal class KonanSymbols(context: Context, val symbolTable: SymbolTable): Sym
|
||||
val getProgressionLast = context.getInternalFunctions("getProgressionLast")
|
||||
.map { Pair(it.returnType, symbolTable.referenceSimpleFunction(it)) }.toMap()
|
||||
|
||||
val arrayContentToString = arrayTypes.associateBy({ it }, { arrayExtensionFun(it, "contentToString") })
|
||||
val arrayContentHashCode = arrayTypes.associateBy({ it }, { arrayExtensionFun(it, "contentHashCode") })
|
||||
val arrayContentToString = arrayTypes.associateBy({ it }, { findArrayExtension(it, "contentToString") })
|
||||
val arrayContentHashCode = arrayTypes.associateBy({ it }, { findArrayExtension(it, "contentHashCode") })
|
||||
|
||||
fun findArrayExtension(type: KotlinType, name: String): IrSimpleFunctionSymbol {
|
||||
val descriptor = builtInsPackage("kotlin", "collections")
|
||||
.getContributedFunctions(Name.identifier(name), NoLookupLocation.FROM_BACKEND)
|
||||
.singleOrNull {
|
||||
it.valueParameters.isEmpty()
|
||||
&& (it.extensionReceiverParameter?.type?.constructor?.declarationDescriptor as? ClassDescriptor)?.defaultType == type
|
||||
&& it.isActual
|
||||
}
|
||||
?: throw Error(type.toString())
|
||||
return symbolTable.referenceSimpleFunction(descriptor)
|
||||
}
|
||||
|
||||
override val copyRangeTo = arrays.map { symbol ->
|
||||
val packageViewDescriptor = builtIns.builtInsModule.getPackage(KotlinBuiltIns.COLLECTIONS_PACKAGE_FQ_NAME)
|
||||
|
||||
+3
-1
@@ -51,7 +51,9 @@ internal class LateinitLowering(
|
||||
private val kotlinPackageScope = context.ir.irModule.descriptor.getPackage(KOTLIN_FQ_NAME).memberScope
|
||||
private val isInitializedPropertyDescriptor = kotlinPackageScope
|
||||
.getContributedVariables(Name.identifier("isInitialized"), NoLookupLocation.FROM_BACKEND).single {
|
||||
it.extensionReceiverParameter.let { it != null && TypeUtils.getClassDescriptor(it.type) == context.reflectionTypes.kProperty0 }
|
||||
it.extensionReceiverParameter.let {
|
||||
it != null && TypeUtils.getClassDescriptor(it.type) == context.reflectionTypes.kProperty0
|
||||
} && it.isActual
|
||||
}
|
||||
private val isInitializedGetterDescriptor = isInitializedPropertyDescriptor.getter!!
|
||||
|
||||
|
||||
@@ -170,10 +170,10 @@ fun testReverse() {
|
||||
assertTrue(builder === builder.reverse())
|
||||
assertEquals(builder, "654321")
|
||||
|
||||
builder.length = 1
|
||||
builder.setLength(1)
|
||||
assertEquals(builder, "6")
|
||||
|
||||
builder.length = 0
|
||||
builder.setLength(0)
|
||||
assertEquals(builder, "")
|
||||
|
||||
var str: String = "a"
|
||||
@@ -261,7 +261,7 @@ fun testBasic() {
|
||||
assertEquals(19, sb.length)
|
||||
assertEquals("1, true12345678null", sb.toString())
|
||||
|
||||
sb.length = 0
|
||||
sb.setLength(0)
|
||||
assertEquals(0, sb.length)
|
||||
assertEquals("", sb.toString())
|
||||
}
|
||||
|
||||
@@ -965,7 +965,7 @@ class PatternTest2 {
|
||||
assertEquals(4, result!!.range.start)
|
||||
|
||||
// modify text
|
||||
text.length = 0
|
||||
text.setLength(0)
|
||||
text.append("Text have been changed.")
|
||||
|
||||
assertNull(regex.find(text))
|
||||
|
||||
Reference in New Issue
Block a user