K2: don't approximate captured types in ResultTypeResolver in certain cases
To be more precises, ResultTypeResolver for K2 now searches for similar LOWER/UPPER constraints pair based on the same flexible type, like LOWER(CapturedType&Any..CapturedType?) and UPPER(CapturedType!). If such a pair is found, the CapturedType is not approximated. This is done to avoid a big difference between this case and completely same constraints, like LOWER(CapturedType!) and UPPER(CapturedType!). In this case we squash them to EQUAL(CapturedType!) even before ResultTypeResolver, and captured types which is got from an EQUAL constraint are not approximated even before this commit. This commit fixes back a case from KT-50134 and a problem with intellij.vcs.git #KT-65596 Fixed
This commit is contained in:
committed by
Space Team
parent
c966533d73
commit
d04625666a
@@ -6,12 +6,12 @@ import java.util.stream.Collectors
|
||||
|
||||
fun foo(){
|
||||
listOf("").stream().collect(
|
||||
<!ARGUMENT_TYPE_MISMATCH, NEW_INFERENCE_ERROR!>Collectors.groupingBy(
|
||||
Collectors.groupingBy(
|
||||
{ it },
|
||||
Collectors.collectingAndThen(
|
||||
Collectors.counting<String>(),
|
||||
Long::toInt
|
||||
)
|
||||
)<!>
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user