Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/resolve/hidesMembers2.kt
T
Denis.Zharkov 2ecba6ac39 Remove WITH_NEW_INFERENCE directive from all tests
This directive anyway does not make test run twice with OI, and with NI
It only once run the test with specific settings (// LANGUAGE)
and ignores irrelevant (OI or NI tags)
2021-05-25 13:28:26 +03:00

44 lines
1.0 KiB
Kotlin
Vendored

// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class A {
fun forEach() = this
fun forEach(i: Int) = this
}
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@kotlin.internal.HidesMembers
fun A.forEach(i: Int) = i
class B {
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@kotlin.internal.HidesMembers
fun A.forEach() = this@B
fun test(a: A) {
a.forEach() checkType { _<A>() } // todo
with(a) {
forEach() checkType { _<A>() } // todo
}
}
}
fun test2(a: A) {
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@kotlin.internal.HidesMembers
fun A.forEach() = ""
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@kotlin.internal.HidesMembers
fun A.forEach(i: Int) = ""
a.forEach() checkType { _<String>() }
a.<!OVERLOAD_RESOLUTION_AMBIGUITY!>forEach<!>(1)
with(a) {
forEach() checkType { _<String>() }
<!OVERLOAD_RESOLUTION_AMBIGUITY!>forEach<!>(1)
}
}