Refactor CallableReferencesResolutionUtils.kt

Get rid of trace & reportOn parameters of
createReflectionTypeForCallableDescriptor: move the two checks that required
them to DoubleColonExpressionResolver and combine with other checks into a
single function that checks the validity of the referenced symbol. This also
makes these checks reported only once when invalid expressions are passed as
function arguments (previously they were also reported from
getResolvedCallableReferenceShapeType).

Also inline getReflectionTypeForCandidateDescriptor after this, and refactor
its usages
This commit is contained in:
Alexander Udalov
2016-06-21 17:32:29 +03:00
parent cf630e01db
commit 80bf6e1bee
8 changed files with 74 additions and 98 deletions
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
class A {
fun Int.extInt() = 42
fun A.extA(x: String) = x
@@ -6,9 +6,14 @@ class A {
fun main() {
Int::<!EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>extInt<!>
A::<!EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>extA<!>
eat(Int::<!EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>extInt<!>)
eat(A::<!EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>extA<!>)
}
}
fun eat(value: Any) {}
fun main() {
A::<!UNRESOLVED_REFERENCE!>extInt<!>
A::<!UNRESOLVED_REFERENCE!>extA<!>