[NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI
There is added a new service named `SubstitutingScopeProvider`, that provides factory that creates captured types and approximator for them. In OI they are the same as before commit, for NI they are empty, because that approximation interferes with NI algorithm That service is injected into function descriptors and property descriptors and used for creating `SubstitutingScope` with correct services Also there is changed time when we approximate captured types in NI (after all call checkers) #KT-25290 Fixed
This commit is contained in:
+6
-6
@@ -5,15 +5,15 @@
|
||||
fun <T: Any> bar(a: Array<T>): Array<T?> = null!!
|
||||
|
||||
fun test1(a: Array<out Int>) {
|
||||
val r: Array<out Int?> = <!NI;TYPE_MISMATCH!><!NI;UNSUPPORTED!>bar<!>(a)<!>
|
||||
val t = <!NI;UNSUPPORTED!>bar<!>(a)
|
||||
<!NI;UNSUPPORTED!>t<!> checkType { <!NI;DEBUG_INFO_UNRESOLVED_WITH_TARGET, NI;UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Array<out Int?>>() }
|
||||
val r: Array<out Int?> = bar(a)
|
||||
val t = bar(a)
|
||||
t checkType { _<Array<out Int?>>() }
|
||||
}
|
||||
|
||||
fun <T: Any> foo(l: Array<T>): Array<Array<T?>> = null!!
|
||||
|
||||
fun test2(a: Array<out Int>) {
|
||||
val r: Array<out Array<out Int?>> = <!NI;TYPE_MISMATCH!><!NI;UNSUPPORTED!>foo<!>(a)<!>
|
||||
val t = <!NI;UNSUPPORTED!>foo<!>(a)
|
||||
<!NI;UNSUPPORTED!>t<!> checkType { <!NI;DEBUG_INFO_UNRESOLVED_WITH_TARGET, NI;UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Array<out Array<out Int?>>>() }
|
||||
val r: Array<out Array<out Int?>> = foo(a)
|
||||
val t = foo(a)
|
||||
t checkType { _<Array<out Array<out Int?>>>() }
|
||||
}
|
||||
+1
-1
@@ -16,5 +16,5 @@ fun <S> test1(a: ParameterizedChild<S>?, b: Child): Base<S> = myRun {
|
||||
}
|
||||
|
||||
fun <S> test2(a: S?, b: S): S = myRun {
|
||||
<!TYPE_MISMATCH, TYPE_MISMATCH!>select(a, b)<!>
|
||||
<!TYPE_MISMATCH!>select(a, b)<!>
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@ fun <A, B> Foo<A>.map(<!UNUSED_PARAMETER!>f<!>: (A) -> B): Foo<B> = object : Foo
|
||||
|
||||
fun foo() {
|
||||
val l: Foo<String> = object : Foo<String> {}
|
||||
val <!UNUSED_VARIABLE!>m<!>: Foo<String> = l.<!OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>map { <!UNUSED_ANONYMOUS_PARAMETER!>ppp<!> -> <!NI;CONSTANT_EXPECTED_TYPE_MISMATCH, NI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!> }<!>
|
||||
val <!UNUSED_VARIABLE!>m<!>: Foo<String> = l.<!OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>map { <!UNUSED_ANONYMOUS_PARAMETER!>ppp<!> -> <!NI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!> }<!>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user