Files
kotlin/compiler/testData/diagnostics/tests/callableReference/function/innerConstructorFromExtension.kt
Alexander Udalov 661f4efc68 Forbid callable references to members and extensions with empty LHS
This syntax is reserved to be likely used in the future as a shorthand for
"this::foo" where the resulting expression doesn't take the receiver as a
parameter but has "this" already bound to it
2015-10-03 04:37:04 +03:00

22 lines
407 B
Kotlin
Vendored

// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION
import kotlin.reflect.KFunction1
class A {
inner class Inner
}
fun A.main() {
::<!CALLABLE_REFERENCE_TO_MEMBER_OR_EXTENSION_WITH_EMPTY_LHS!>Inner<!>
val y = A::Inner
checkSubtype<KFunction1<A, A.Inner>>(y)
}
fun Int.main() {
::<!UNRESOLVED_REFERENCE!>Inner<!>
val y = A::Inner
checkSubtype<KFunction1<A, A.Inner>>(y)
}