UAST properly handles string "when conditions" in lazy parent (KT-20709) (#1338)
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
val a = readLine()
|
||||
|
||||
val b = when(a) {
|
||||
"abc" -> 1
|
||||
"def", "ghi" -> 2
|
||||
else -> 3
|
||||
}
|
||||
|
||||
when(a) {
|
||||
"abc1" -> println(1)
|
||||
"def1", "ghi1" -> println(2)
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
UFile (package = )
|
||||
UClass (name = WhenStringLiteralKt)
|
||||
UField (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.Nullable)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (readLine))
|
||||
USimpleNameReferenceExpression (identifier = readLine)
|
||||
UField (name = b)
|
||||
UAnnotation (fqName = null)
|
||||
USwitchExpression
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
UExpressionList (when)
|
||||
USwitchClauseExpressionWithBody
|
||||
ULiteralExpression (value = "abc")
|
||||
UExpressionList (when_entry)
|
||||
ULiteralExpression (value = 1)
|
||||
UBreakExpression (label = null)
|
||||
USwitchClauseExpressionWithBody
|
||||
ULiteralExpression (value = "def")
|
||||
ULiteralExpression (value = "ghi")
|
||||
UExpressionList (when_entry)
|
||||
ULiteralExpression (value = 2)
|
||||
UBreakExpression (label = null)
|
||||
USwitchClauseExpressionWithBody
|
||||
UExpressionList (when_entry)
|
||||
ULiteralExpression (value = 3)
|
||||
UBreakExpression (label = null)
|
||||
UAnnotationMethod (name = getA)
|
||||
UAnnotationMethod (name = getB)
|
||||
UAnnotationMethod (name = <no name provided>)
|
||||
UBlockExpression
|
||||
ULiteralExpression (value = "abc1")
|
||||
ULiteralExpression (value = "def1")
|
||||
@@ -0,0 +1,27 @@
|
||||
public final class WhenStringLiteralKt {
|
||||
private static final var a: java.lang.String = readLine()
|
||||
private static final var b: int = switch (a) {
|
||||
"abc" -> {
|
||||
1
|
||||
break
|
||||
}
|
||||
|
||||
"def", "ghi" -> {
|
||||
2
|
||||
break
|
||||
}
|
||||
|
||||
-> {
|
||||
3
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final fun getA() : java.lang.String = UastEmptyExpression
|
||||
public static final fun getB() : int = UastEmptyExpression
|
||||
public static final fun <no name provided>() : void {
|
||||
"abc1"
|
||||
"def1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user