Files
kotlin/compiler/testData/codegen/box/multiDecl/UnderscoreNames.kt
Dmitry Petrov caae6ff2ec KT-16264 Forbid usage of _ without backticks
Forbid underscore-only (_, __, ___, ...) names as callees and as types.

If CHECK_TYPE directive is on, filter out UNDERSCORE_USAGE_WITHOUT_BACKTICKS messages.
2017-03-29 15:47:22 +03:00

15 lines
244 B
Kotlin
Vendored

class A {
operator fun component1() = 1
operator fun component2() = 2
}
fun box() : String {
val (_, b) = A()
val (a, _) = A()
val (`_`, c) = A()
return if (a == 1 && b == 2 && `_` == 1 && c == 2) "OK" else "fail"
}