Fix another non-determinism in CommonSupertypes

This commit is contained in:
Alexander Udalov
2018-05-03 14:05:29 +02:00
parent e07f83ddbc
commit a2d45062c2
3 changed files with 60 additions and 3 deletions
@@ -214,7 +214,7 @@ public class CommonSupertypes {
assert order != null;
Set<TypeConstructor> notSource = new HashSet<>();
Map<TypeConstructor, Set<SimpleType>> result = new HashMap<>();
Map<TypeConstructor, Set<SimpleType>> result = new LinkedHashMap<>();
for (TypeConstructor superConstructor : order) {
if (!commonSuperclasses.contains(superConstructor)) {
continue;
@@ -381,7 +381,7 @@ public class CommonSupertypes {
@Override
public boolean beforeChildren(SimpleType current) {
Set<SimpleType> instances =
constructorToAllInstances.computeIfAbsent(current.getConstructor(), k -> new HashSet<>());
constructorToAllInstances.computeIfAbsent(current.getConstructor(), k -> new LinkedHashSet<>());
instances.add(current);
return true;
@@ -8,4 +8,17 @@ open class B : In<B>
fun <T> select(x: T, y: T) = x
fun <!OI;IMPLICIT_INTERSECTION_TYPE!>foo2<!>() = select(A(), B()) // Type is In<A & B> is prohibited in return position
fun <!OI;IMPLICIT_INTERSECTION_TYPE!>foo2<!>() = select(A(), B()) // Type "In<A & B>" is prohibited in return position
open class C : In<C>
open class D : In<D>
open class E : In<E>
open class F : In<F>
open class G : In<G>
open class H : In<H>
fun <S> select8(a: S, b: S, c: S, d: S, e: S, f: S, g: S, h: S) = a
fun <!OI;IMPLICIT_INTERSECTION_TYPE!>foo8<!>() = select8(A(), B(), C(), D(), E(), F(), G(), H())
@@ -1,7 +1,9 @@
package
public fun foo2(): In<{A & B}>
public fun foo8(): In<{A & B & C & D & E & F & G & H}>
public fun </*0*/ T> select(/*0*/ x: T, /*1*/ y: T): T
public fun </*0*/ S> select8(/*0*/ a: S, /*1*/ b: S, /*2*/ c: S, /*3*/ d: S, /*4*/ e: S, /*5*/ f: S, /*6*/ g: S, /*7*/ h: S): S
public open class A : In<A> {
public constructor A()
@@ -17,6 +19,48 @@ public open class B : In<B> {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public open class C : In<C> {
public constructor C()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public open class D : In<D> {
public constructor D()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public open class E : In<E> {
public constructor E()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public open class F : In<F> {
public constructor F()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public open class G : In<G> {
public constructor G()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public open class H : In<H> {
public constructor H()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface In</*0*/ in E> {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int