Revert "[NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI"

This reverts commit 7c4101e21c.

 #KT-31866 Fixed
 #KT-31868 Fixed
 #EA-125401 Fixed
 #KT-25290 Open
This commit is contained in:
Mikhail Zarechenskiy
2019-06-04 17:41:43 +03:00
parent f48640f91c
commit 787a8bb9bd
79 changed files with 197 additions and 887 deletions
@@ -5,6 +5,6 @@ interface Tr<T> {
}
fun test(t: Tr<*>) {
<!SETTER_PROJECTED_OUT!>t.v<!> = <!NI;TYPE_MISMATCH!>t<!>
<!SETTER_PROJECTED_OUT!>t.v<!> = t
t.v checkType { _<Tr<*>>() }
}
@@ -7,9 +7,8 @@ interface Tr<T> {
}
fun test(t: Tr<*>) {
<!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 = null!!
<!SETTER_PROJECTED_OUT!>t.v<!> = ""
<!SETTER_PROJECTED_OUT!>t.v<!> = null
t.v checkType { _<Any?>() }
}
@@ -1,16 +0,0 @@
// !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!>""<!>
}
@@ -1,12 +0,0 @@
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
}
@@ -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)
<!NI;TYPE_MISMATCH!><!SETTER_PROJECTED_OUT!>t.v<!> += null!!<!>
<!SETTER_PROJECTED_OUT!>t.v<!> += null!!
}