Refactor resolution of double colon expression LHS

Try resolving the LHS only when it looks (PSI-wise) like it could represent a
type element. This, for example, allows "illegal selector" error to be reported
on weird expressions like '""?.""::class'.

Also remove expression text from the "illegal selector" diagnostic, it's not
needed and can screw up the error message if the text is too big
This commit is contained in:
Alexander Udalov
2016-06-17 15:19:45 +03:00
parent 5a2f34b351
commit 5a6237b357
9 changed files with 125 additions and 52 deletions
@@ -0,0 +1,8 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
fun test() {
"a".<!ILLEGAL_SELECTOR!>"b"<!>::<!UNRESOLVED_REFERENCE!>foo<!>
"a".<!ILLEGAL_SELECTOR!>"b"<!>::class
"a".<!ILLEGAL_SELECTOR!>"b"<!>.<!ILLEGAL_SELECTOR!>"c"<!>::<!UNRESOLVED_REFERENCE!>foo<!>
"a".<!ILLEGAL_SELECTOR!>"b"<!>.<!ILLEGAL_SELECTOR!>"c"<!>::class
}
@@ -0,0 +1,3 @@
package
public fun test(): kotlin.Unit