[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:
+1
-1
@@ -5,6 +5,6 @@ interface Tr<T> {
|
||||
}
|
||||
|
||||
fun test(t: Tr<*>) {
|
||||
<!SETTER_PROJECTED_OUT!>t.v<!> = t
|
||||
<!SETTER_PROJECTED_OUT!>t.v<!> = <!NI;TYPE_MISMATCH!>t<!>
|
||||
t.v checkType { _<Tr<*>>() }
|
||||
}
|
||||
+4
-3
@@ -7,8 +7,9 @@ interface Tr<T> {
|
||||
}
|
||||
|
||||
fun test(t: Tr<*>) {
|
||||
t.v = null!!
|
||||
<!SETTER_PROJECTED_OUT!>t.v<!> = ""
|
||||
<!SETTER_PROJECTED_OUT!>t.v<!> = null
|
||||
<!NI;SETTER_PROJECTED_OUT!>t.v<!> = null!!
|
||||
<!SETTER_PROJECTED_OUT!>t.v<!> = <!NI;TYPE_MISMATCH!>""<!>
|
||||
<!SETTER_PROJECTED_OUT!>t.v<!> = <!NI;NULL_FOR_NONNULL_TYPE!>null<!>
|
||||
|
||||
t.v checkType { _<Any?>() }
|
||||
}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// Issue: KT-31594
|
||||
|
||||
// FILE: Tr.java
|
||||
|
||||
public class Tr<T> {
|
||||
public T getV() { return null; }
|
||||
public void setV(T value) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun test(t: Tr<*>) {
|
||||
<!NI;SETTER_PROJECTED_OUT!>t.v<!> = null
|
||||
<!NI;SETTER_PROJECTED_OUT!>t.v<!> = <!NI;TYPE_MISMATCH!>""<!>
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
package
|
||||
|
||||
public fun test(/*0*/ t: Tr<*>): kotlin.Unit
|
||||
|
||||
public open class Tr</*0*/ T : kotlin.Any!> {
|
||||
public constructor Tr</*0*/ T : kotlin.Any!>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun getV(): T!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun setV(/*0*/ value: T!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
+1
-1
@@ -7,5 +7,5 @@ interface Tr<T> {
|
||||
fun test(t: Tr<out String>) {
|
||||
// resolved as t.v = t.v + null!!, where type of right operand is String,
|
||||
// so TYPE_MISMATCH: String is not <: of Captured(out String)
|
||||
<!SETTER_PROJECTED_OUT!>t.v<!> += null!!
|
||||
<!NI;TYPE_MISMATCH!><!SETTER_PROJECTED_OUT!>t.v<!> += null!!<!>
|
||||
}
|
||||
Reference in New Issue
Block a user