'val' in 'when' subject can't have modifiers (annotations are ok)

This commit is contained in:
Dmitry Petrov
2018-06-08 16:25:17 +03:00
parent 53fd883e2a
commit 67247ee490
9 changed files with 378 additions and 1 deletions
@@ -0,0 +1,29 @@
fun test() {
when (abstract) {}
when (enum) {}
when (open) {}
when (inner) {}
when (override) {}
when (private) {}
when (public) {}
when (internal) {}
when (protected) {}
when (out) {} // NB 'in' is a hard keyword
when (final) {}
when (vararg) {}
when (reified) {}
when (companion) {}
when (sealed) {}
when (lateinit) {}
when (data) {}
when (inline) {}
when (noinline) {}
when (tailrec) {}
when (external) {}
when (annotation) {}
when (crossinline) {}
when (const) {}
when (operator) {}
when (infix) {}
when (suspend) {}
}
@@ -0,0 +1,316 @@
KtFile: WhenWithSubjectVariable_SoftModifierName.kt
PACKAGE_DIRECTIVE
<empty list>
IMPORT_LIST
<empty list>
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('test')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('abstract')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('enum')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('open')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('inner')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('override')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('private')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('public')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('internal')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('protected')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('out')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace(' ')
PsiComment(EOL_COMMENT)('// NB 'in' is a hard keyword')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('final')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('vararg')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('reified')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('companion')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('sealed')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('lateinit')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('data')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('inline')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('noinline')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('tailrec')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('external')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('annotation')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('crossinline')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('const')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('operator')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('infix')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
PsiElement(when)('when')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('suspend')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')