Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41741.kt
T
Victor Petukhov 0857b9c9e7 Rethink constraints incorporation
Namely, remove incorporation “otherInsideMyConstraint” to eliminate
constraint system redundancy and produce a potentially very large number
 of constructs.
Instead, introduce not so “spreadable” incorporation during variable
fixation (equality constraint with result type into other constraints).
^KT-41644 Fixed
^KT-42195 Fixed
^KT-42920 Fixed
^KT-42791 Fixed
^KT-41741 Fixed
2020-11-25 11:15:20 +03:00

38 lines
1.1 KiB
Kotlin
Vendored

// FIR_IDENTICAL
// FILE: Simple.java
// FULL_JDK
// WITH_RUNTIME
// !DIAGNOSTICS: -UNUSED_PARAMETER -CAST_NEVER_SUCCEEDS -UNUSED_VARIABLE
import java.util.*;
import java.util.function.Supplier;
public class Simple<K, V, C extends E, E extends Collection<V>> {
public Simple(Map<K, C> backingMap, Supplier<? extends C> innerCollectionCreator) {
// TODO
}
public final void add(K key, V value) {
//TODO
}
public static class ListSimple<K, V> extends Simple<K, V, List<V>, List<V>> {
public ListSimple(Map<K, List<V>> backingMap, Supplier<? extends List<V>> innerCollectionCreator) {
super(backingMap, innerCollectionCreator);
}
}
}
// FILE: main.kt
import java.util.*
fun <K, V, C : E, E : Collection<V>, B: Simple<K, V, C, E>> Iterable<V>.groupByTo(destination: B, keySelector: (V) -> K) = null as B
enum class Format { Foo, Bar }
class Instance(val format: Format)
fun main(x: List<Instance>) {
val doesntWork = x.groupByTo(
Simple.ListSimple(EnumMap<Format, List<Instance>>(Format::class.java), ::LinkedList)
) { it.format } // Internal Error occurred while analyzing this expression
}