[NI] Test data to understand changes in the next commit

##KT-31969 In Progress
This commit is contained in:
Mikhail Zarechenskiy
2019-06-18 16:28:13 +03:00
parent 50ad21e388
commit ca997de6a7
9 changed files with 147 additions and 0 deletions
@@ -0,0 +1,12 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
// !WITH_NEW_INFERENCE
open class View
fun test() {
val target = foo<View>() ?: foo() <!NI;USELESS_ELVIS!>?: run {}<!>
}
fun <T : View> foo(): T? {
return null
}
@@ -0,0 +1,11 @@
package
public fun </*0*/ T : View> foo(): T?
public fun test(): kotlin.Unit
public open class View {
public constructor View()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,27 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface ISample
fun <K> elvisSimple(x: K?, y: K): K = y
@Suppress("INVISIBLE_REFERENCE")
fun <K> elvisExact(x: K?, y: K): @kotlin.internal.Exact K = y
fun <T : Number> materialize(): T? = TODO()
fun test(nullableSample: ISample, any: Any) {
<!DEBUG_INFO_EXPRESSION_TYPE("ISample")!>elvisSimple(
nullableSample,
<!TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>materialize<!>()
)<!>
elvisSimple(
<!DEBUG_INFO_EXPRESSION_TYPE("ISample")!>elvisSimple(nullableSample, <!TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>materialize<!>())<!>,
any
)
elvisSimple(
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>elvisExact(nullableSample, materialize())<!>,
any
)
}
@@ -0,0 +1,12 @@
package
@kotlin.Suppress(names = {"INVISIBLE_REFERENCE"}) public fun </*0*/ K> elvisExact(/*0*/ x: K?, /*1*/ y: K): K
public fun </*0*/ K> elvisSimple(/*0*/ x: K?, /*1*/ y: K): K
public fun </*0*/ T : kotlin.Number> materialize(): T?
public fun test(/*0*/ nullableSample: ISample, /*1*/ any: kotlin.Any): kotlin.Unit
public interface ISample {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,28 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface ISample
fun <K> elvisSimple(x: K?, y: K): K = y
@Suppress("INVISIBLE_REFERENCE")
fun <K> elvisExact(x: K?, y: K): @kotlin.internal.Exact K = y
fun <T : Number> materialize(): T? = null
fun test(nullableSample: ISample, any: Any) {
<!DEBUG_INFO_EXPRESSION_TYPE("ISample")!>elvisSimple(
nullableSample,
<!DEBUG_INFO_EXPRESSION_TYPE("{ISample & Number}?")!>materialize()<!>
)<!>
elvisSimple(
<!DEBUG_INFO_EXPRESSION_TYPE("ISample")!>elvisSimple(nullableSample, materialize())<!>,
any
)
elvisSimple(
<!DEBUG_INFO_EXPRESSION_TYPE("ISample")!>elvisExact(nullableSample, materialize())<!>,
any
)
}
@@ -0,0 +1,12 @@
package
@kotlin.Suppress(names = {"INVISIBLE_REFERENCE"}) public fun </*0*/ K> elvisExact(/*0*/ x: K?, /*1*/ y: K): K
public fun </*0*/ K> elvisSimple(/*0*/ x: K?, /*1*/ y: K): K
public fun </*0*/ T : kotlin.Number> materialize(): T?
public fun test(/*0*/ nullableSample: ISample, /*1*/ any: kotlin.Any): kotlin.Unit
public interface ISample {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}