K2: Fix generic inference case with !! synthetic call

Result of the `checkNotNull` calls should always be a non-nullable
values.
The simplest idea how to acheive it is adding not-nullable Any bound
to the type parameter declaration.

Existing comment stating about impossibility of such bound seems to be
not 100% correct because it doesn't take into account presence of
definitely-non-nullable X & Any types that allow described case with
nullable generic.

^KT-55804 Fixed
This commit is contained in:
Denis.Zharkov
2023-03-30 19:03:31 +02:00
committed by Space Team
parent 352316ba9f
commit 56557fb8ff
11 changed files with 95 additions and 11 deletions
@@ -1,3 +1,3 @@
fun main() {
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!UNSUPPORTED!>[]<!><!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>!!<!>
<!UNSUPPORTED!>[]<!><!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!><!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
}