mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-16 00:21:32 +00:00
Without this, the unrelated type specified on the LHS of a property reference literal was considered to be an extension receiver of the candidate, and the resolution was erroneously successul. This is only reproducible for properties, because if we're trying to resolve an extension, we consider all properties from the scope, even non-extensions, because there may be a property of an extension-functional type (T.() -> R). (We don't do this for functions.) #KT-7430 Fixed #KT-7945 Fixed
16 lines
448 B
Kotlin
Vendored
16 lines
448 B
Kotlin
Vendored
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
|
class A {
|
|
fun Int.extInt() = 42
|
|
fun A.extA(x: String) = x
|
|
|
|
fun main() {
|
|
::<!MISSING_RECEIVER, EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>extInt<!>
|
|
::<!EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>extA<!>
|
|
}
|
|
}
|
|
|
|
fun main() {
|
|
A::<!MISSING_RECEIVER, EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>extInt<!>
|
|
A::<!MISSING_RECEIVER, EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>extA<!>
|
|
}
|