diff --git a/compiler/testData/diagnostics/tests/implicitIntersection.txt b/compiler/testData/diagnostics/tests/implicitIntersection.txt index e911069eabe..b36ec1e4c66 100644 --- a/compiler/testData/diagnostics/tests/implicitIntersection.txt +++ b/compiler/testData/diagnostics/tests/implicitIntersection.txt @@ -1,7 +1,7 @@ package public fun bar(/*0*/ b: B): kotlin.String -public fun foo(/*0*/ b: B): {A & C & B}? +public fun foo(/*0*/ b: B): {A & B & C}? public fun gav(/*0*/ b: B): A? public interface A { @@ -25,10 +25,10 @@ public interface C { public final class My { public constructor My(/*0*/ b: B) - public final val x: {A & C & B}? + public final val x: {A & B & C}? public final val y: C? public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ b: B): {A & C & B}? + public final fun foo(/*0*/ b: B): {A & B & C}? public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/IntersectionTypeConstructor.kt b/core/descriptors/src/org/jetbrains/kotlin/types/IntersectionTypeConstructor.kt index b2092cbf6e3..f0e097bd7ce 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/IntersectionTypeConstructor.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/IntersectionTypeConstructor.kt @@ -51,7 +51,7 @@ class IntersectionTypeConstructor(typesToIntersect: Collection) : Ty makeDebugNameForIntersectionType(intersectedTypes) private fun makeDebugNameForIntersectionType(resultingTypes: Iterable): String = - resultingTypes.joinToString(separator = " & ", prefix = "{", postfix = "}") + resultingTypes.sortedBy { it.toString() }.joinToString(separator = " & ", prefix = "{", postfix = "}") override fun equals(other: Any?): Boolean { if (this === other) return true