Preserve order of types in new type intersector

This commit is contained in:
Mikhail Zarechenskiy
2017-09-03 20:05:51 +03:00
parent d8b46406ab
commit dd9ffd10b6
@@ -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<KotlinType>) = 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
}