[FIR] Restore variable fixation direction in call completion

Several tests are affected by the usage of fixation direction calculator in FIR.
Restored to mimimize test data changes.

It is unnecessary in FE10 because a type variable with unknown type
is inferred into an error type, but affects test data in FIR where
Nothing/Any is selected by direction (as a temporary measure).

CR candidate in spec test is Unresolved in FIR because top-level CRs are resolved as call arguments.
Resolution ambiguity is also present in FE10 when CR is wrapped into an id call.
This commit is contained in:
Pavel Kirpichenkov
2020-10-02 15:20:39 +03:00
parent 712a2ce1ab
commit ef44077cb7
17 changed files with 57 additions and 57 deletions
@@ -19,6 +19,6 @@ fun testFunctions() {
fun testNestedCalls() {
id<String>(inferFromLambda { materialize() })
<!INAPPLICABLE_CANDIDATE!>id<!><String>(inferFromLambda(fun() = materialize()))
<!INAPPLICABLE_CANDIDATE!>id<!><String>(inferFromLambda2(fun() = materialize()))
id<String>(inferFromLambda(fun() = materialize()))
id<String>(inferFromLambda2(fun() = materialize()))
}
@@ -7,8 +7,7 @@ fun <T> foo() = foo() as T
fun <T> foo2(): T = TODO()
// TODO: "not enough information" should be reported on foo2() instead
val test = foo2().<!UNRESOLVED_REFERENCE!>plus<!>("") as String
val test = foo2().plus("") as String
fun <T> T.bar() = this
val barTest = "".bar() as Number
@@ -0,0 +1,20 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
// WITH_RUNTIME
import kotlin.experimental.ExperimentalTypeInference
@UseExperimental(ExperimentalTypeInference::class)
fun <R> combined(
check: () -> Unit,
@BuilderInference block: TestInterface<R>.() -> Unit
): R = TODO()
interface TestInterface<R> {
fun emit(r: R)
}
fun test() {
val ret = combined({ }) {
<!INAPPLICABLE_CANDIDATE!>emit<!>(1)
}
}
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
// WITH_RUNTIME
@@ -10,7 +10,7 @@ interface A
interface TypeConstructor
class Refiner {
val memoizedFunctionLambda = createMemoizedFunction { it.<!INAPPLICABLE_CANDIDATE!>foo<!>() } // error type infered, no diagnostic, BAD, backend fails
val memoizedFunctionLambda = createMemoizedFunction { it.foo() } // error type infered, no diagnostic, BAD, backend fails
val memoizedFunctionReference = <!INAPPLICABLE_CANDIDATE!>createMemoizedFunction<!>(<!UNRESOLVED_REFERENCE!>TypeConstructor::foo<!>) // EXTENSION_IN_CLASS_REFERENCE_IS_NOT_ALLOWED, fine
val memoizedFunctionTypes = createMemoizedFunction<TypeConstructor, Boolean> { it.foo() } // works fine