Basic support for when() expressions
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
fun foo() {
|
||||
val s = ""
|
||||
val x = 1
|
||||
when (x) {
|
||||
<error>s</error> => 1
|
||||
1 => 1
|
||||
1 + <error>a</error> => 1
|
||||
in 1..<error>a</error> => 1
|
||||
!in 1..<error>a</error> => 1
|
||||
.<error>a</error> => 1
|
||||
.equals(1).<error>a</error> => 1
|
||||
<warning>?.</warning>equals(1) => 1
|
||||
}
|
||||
when (<warning>x</warning>?:null) {
|
||||
<error>.</error>equals(1) => 1
|
||||
?.equals(1).equals(2) => 1
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,8 @@ JetFile: NewlinesInParentheses.jet
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN_ENTRY
|
||||
WHEN_CONDITION_IN_RANGE
|
||||
PsiElement(in)('in')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(in)('in')
|
||||
PsiWhiteSpace(' ')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -290,7 +291,8 @@ JetFile: NewlinesInParentheses.jet
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN_ENTRY
|
||||
WHEN_CONDITION_IN_RANGE
|
||||
PsiElement(NOT_IN)('!in')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(NOT_IN)('!in')
|
||||
PsiWhiteSpace(' ')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
|
||||
@@ -755,7 +755,8 @@ JetFile: When.jet
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN_ENTRY
|
||||
WHEN_CONDITION_IN_RANGE
|
||||
PsiElement(in)('in')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(in)('in')
|
||||
PsiWhiteSpace(' ')
|
||||
BINARY_EXPRESSION
|
||||
INTEGER_CONSTANT
|
||||
@@ -772,7 +773,8 @@ JetFile: When.jet
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN_ENTRY
|
||||
WHEN_CONDITION_IN_RANGE
|
||||
PsiElement(NOT_IN)('!in')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(NOT_IN)('!in')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('2')
|
||||
|
||||
@@ -59,7 +59,8 @@ JetFile: When_ERR.jet
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN_ENTRY
|
||||
WHEN_CONDITION_IN_RANGE
|
||||
PsiElement(in)('in')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(in)('in')
|
||||
PsiErrorElement:Expecting an element
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -70,7 +71,8 @@ JetFile: When_ERR.jet
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN_ENTRY
|
||||
WHEN_CONDITION_IN_RANGE
|
||||
PsiElement(NOT_IN)('!in')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(NOT_IN)('!in')
|
||||
PsiErrorElement:Expecting an element
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -127,7 +129,8 @@ JetFile: When_ERR.jet
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN_ENTRY
|
||||
WHEN_CONDITION_IN_RANGE
|
||||
PsiElement(in)('in')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(in)('in')
|
||||
PsiErrorElement:Expecting an element
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -137,7 +140,8 @@ JetFile: When_ERR.jet
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN_ENTRY
|
||||
WHEN_CONDITION_IN_RANGE
|
||||
PsiElement(NOT_IN)('!in')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(NOT_IN)('!in')
|
||||
PsiErrorElement:Expecting an element
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -147,7 +151,8 @@ JetFile: When_ERR.jet
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN_ENTRY
|
||||
WHEN_CONDITION_IN_RANGE
|
||||
PsiElement(NOT_IN)('!in')
|
||||
OPERATION_REFERENCE
|
||||
PsiElement(NOT_IN)('!in')
|
||||
PsiErrorElement:Expecting an element
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
|
||||
Reference in New Issue
Block a user