Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/resolve/hidesMembers2.kt
T
Dmitriy Novozhilov e6b5cb5216 [TD] Update diagnostics test data due to new test runners
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
2020-12-16 19:52:25 +03:00

45 lines
1.0 KiB
Kotlin
Vendored

// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
// !WITH_NEW_INFERENCE
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)
}
}