[NI] Implement various optimizations for incorporation algorithm

Mostly, these optimisations are picked from the old inference.
 Also, remove exponential complexity for flexible types in approximation,
 note that more correct fix for this would be to introduce new types
 that corresponds just to platform types to avoid nullability problems,
 but due to complexity it will be done later

 #KT-31415 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2019-05-24 14:58:59 +03:00
parent bbec3bf001
commit 8910859fd1
22 changed files with 239 additions and 48 deletions
@@ -7,7 +7,7 @@ fun <T> g (<!UNUSED_PARAMETER!>f<!>: () -> List<T>) : T {<!NO_RETURN_IN_FUNCTION
fun test() {
//here possibly can be a cycle on constraints
val <!UNUSED_VARIABLE!>x<!> = g { Collections.<!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>emptyList<!>() }
val <!UNUSED_VARIABLE!>x<!> = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>g<!> { Collections.<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>emptyList<!>() }
val <!UNUSED_VARIABLE!>y<!> = g<Int> { Collections.emptyList() }
val <!UNUSED_VARIABLE!>z<!> : List<Int> = g { Collections.<!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>emptyList<!>() }