From e1ee31b4ce5576c9ab562ebff218d00cee3e5ed3 Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Tue, 24 Jul 2018 21:43:52 +0200 Subject: [PATCH] Use linked hashmap in properties dsl - preserving order --- .../src/kotlin/script/experimental/misc/propertiesDsl.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/scripting/misc/src/kotlin/script/experimental/misc/propertiesDsl.kt b/libraries/scripting/misc/src/kotlin/script/experimental/misc/propertiesDsl.kt index e824f035f28..f28e2090747 100644 --- a/libraries/scripting/misc/src/kotlin/script/experimental/misc/propertiesDsl.kt +++ b/libraries/scripting/misc/src/kotlin/script/experimental/misc/propertiesDsl.kt @@ -38,18 +38,18 @@ inline operator fun TypedKey>.invoke(vararg vs: E): Pair TypedKey>.invoke(vararg classes: Pair>): Pair>, Map> = - this to HashMap().also { it.putAll(classes.asSequence().map { (k, v) -> k to KotlinType(v) }) } + this to LinkedHashMap().also { it.putAll(classes.asSequence().map { (k, v) -> k to KotlinType(v) }) } @JvmName("invoke_kotlintype_map_from_ktype") inline operator fun TypedKey>.invoke(vararg types: Pair): Pair>, Map> = - this to HashMap().also { it.putAll(types.asSequence().map { (k, v) -> k to KotlinType(v) }) } + this to LinkedHashMap().also { it.putAll(types.asSequence().map { (k, v) -> k to KotlinType(v) }) } @JvmName("invoke_kotlintype_map_from_fqname") inline operator fun TypedKey>.invoke(vararg fqnames: Pair): Pair>, Map> = - this to HashMap().also { it.putAll(fqnames.asSequence().map { (k, v) -> k to KotlinType(v) }) } + this to LinkedHashMap().also { it.putAll(fqnames.asSequence().map { (k, v) -> k to KotlinType(v) }) } inline operator fun TypedKey>.invoke(vararg vs: Pair): Pair>, Map> = - this to hashMapOf(*vs) + this to mapOf(*vs) // TODO: make tests from examples below /*