From dd9ffd10b6726ab8a8c1b55c59502cc59626b360 Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Sun, 3 Sep 2017 20:05:51 +0300 Subject: [PATCH] Preserve order of types in new type intersector --- .../org/jetbrains/kotlin/types/checker/IntersectionType.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/checker/IntersectionType.kt b/core/descriptors/src/org/jetbrains/kotlin/types/checker/IntersectionType.kt index b3d8ba97afc..98f4e65a8d2 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/checker/IntersectionType.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/checker/IntersectionType.kt @@ -19,7 +19,7 @@ package org.jetbrains.kotlin.types.checker import org.jetbrains.kotlin.descriptors.annotations.Annotations import org.jetbrains.kotlin.types.* import java.util.* -import kotlin.collections.HashSet +import kotlin.collections.LinkedHashSet fun intersectWrappedTypes(types: Collection) = intersectTypes(types.map { it.unwrap() }) @@ -90,7 +90,7 @@ object TypeIntersector { * UNKNOWN means, that we do not know, i.e. more precisely, all singleClassifier types marked nullable if any, * and other types is captured types or type parameters without not-null upper bound. Example: `String? & T` such types we should leave as is. */ - val correctNullability = inputTypes.mapTo(HashSet()) { + val correctNullability = inputTypes.mapTo(LinkedHashSet()) { if (resultNullability == ResultNullability.NOT_NULL) it.makeNullableAsSpecified(false) else it }