K2: Apply constraints from forks at UNTIL_FIRST_LAMBDA completion phase
Otherwise, OVERLOAD_RESOLUTION_AMBIGUITY is reported for the calls to the functions annotated as @OverloadResolutionByLambdaReturnType ^KT-43296 In Progress
This commit is contained in:
committed by
Space Team
parent
10d63cc52a
commit
b73acd7a3a
@@ -0,0 +1,26 @@
|
||||
// SKIP_TXT
|
||||
// FIR_IDENTICAL
|
||||
// FULL_JDK
|
||||
// WITH_STDLIB
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
interface ModificationData
|
||||
|
||||
fun main() {
|
||||
val updatedFiles = ConcurrentHashMap<String, ModificationData>()
|
||||
|
||||
// HashMap effectively have two Map supertypes: one like Map<K, V> and one Map<K!, V!> (through AbstractMap)
|
||||
// But here, since `updatedFiles` has only a supertype Map<String!, ModificationData!>
|
||||
// `updatedFilesSnapshot` has two supertypes relevant to Map: Map<String!, ModificationData!> and one Map<String!, ModificationData!>
|
||||
// Actually, we might collapse them, because they're equivalent, but for now we don't
|
||||
val updatedFilesSnapshot = HashMap(updatedFiles)
|
||||
|
||||
// Thus, it leads to constraint system fork during `flatMap` inference
|
||||
// And during overload resolution between two `flatMap` versions with @OverloadResolutionByLambdaReturnType we have to run lambda analysis
|
||||
// So, we have to apply forks to the system on this completion phase too, but still not for the PARTIAL completion mode
|
||||
// Otherwise, OVERLOAD_RESOLUTION_AMBIGUITY happens
|
||||
updatedFilesSnapshot.flatMap { _ ->
|
||||
listOf("")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user