bcc8802014
Expression will be checked against expected type later. Theoretically, this is not very good, but it aligns with the old inference, plus it helps avoiding multiple type mismatch diagnostics.
26 lines
537 B
Kotlin
Vendored
26 lines
537 B
Kotlin
Vendored
// !WITH_NEW_INFERENCE
|
|
// !CHECK_TYPE
|
|
|
|
fun <T> magic(): T = null!!
|
|
|
|
class Q {
|
|
private fun <E> foo() = {
|
|
class C {
|
|
val prop: E = magic()
|
|
}
|
|
C()
|
|
}
|
|
|
|
private var x = <!DEBUG_INFO_LEAKING_THIS!>foo<!><CharSequence>()()
|
|
private var y = <!DEBUG_INFO_LEAKING_THIS!>foo<!><String>()()
|
|
|
|
fun bar() {
|
|
x = <!TYPE_MISMATCH!>y<!>
|
|
x = foo<CharSequence>()()
|
|
y = foo<String>()()
|
|
|
|
x.prop.checkType { _<CharSequence>() }
|
|
y.prop.checkType { _<String>() }
|
|
}
|
|
}
|