Files
kotlin-fork/compiler/testData/diagnostics/tests/subtyping/nestedIntoLocalClasses.kt
T
Mikhail Zarechenskiy bcc8802014 [NI] Avoid constraints from expected type for effectively empty system
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.
2019-04-17 12:55:12 +03:00

23 lines
395 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER
package p
private fun foo(a: Int) = run {
object {
inner class A
fun foo() = A()
}.foo()
}
private fun foo() = run {
object {
inner class A
fun foo() = A()
}.foo()
}
fun test() {
var x = foo(1)
x = <!TYPE_MISMATCH!>foo()<!>
}