FIR UAST: add array access tests
This commit is contained in:
committed by
teamcityserver
parent
9a539aac7d
commit
ef8eddf1da
@@ -0,0 +1,11 @@
|
||||
inline class Z(val data: Int)
|
||||
|
||||
val xs = Array(2) { Z(42) }
|
||||
|
||||
fun box(): String {
|
||||
xs[0] = Z(12)
|
||||
val t = xs[0]
|
||||
if (t.data != 12) throw AssertionError("$t")
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
UFile (package = ) [public final class AccessArrayOfInlineClassKt {...]
|
||||
UClass (name = AccessArrayOfInlineClassKt) [public final class AccessArrayOfInlineClassKt {...}]
|
||||
UField (name = xs) [@org.jetbrains.annotations.NotNull private static final var xs: Z[] = <init>(2, { var it: int ->...})]
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 2)) [<init>(2, { var it: int ->...})] : PsiType:Z[]
|
||||
UIdentifier (Identifier (Array)) [UIdentifier (Identifier (Array))]
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = null) [<init>] : PsiType:Z[]
|
||||
ULiteralExpression (value = 2) [2] : PsiType:int
|
||||
ULambdaExpression [{ var it: int ->...}] : PsiType:Function1<? super Integer, ? extends Z>
|
||||
UParameter (name = it) [var it: int]
|
||||
UBlockExpression [{...}]
|
||||
UReturnExpression [return <init>(42)]
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) [<init>(42)] : PsiType:int
|
||||
UIdentifier (Identifier (Z)) [UIdentifier (Identifier (Z))]
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = PsiClass: Z) [<init>] : PsiType:int
|
||||
ULiteralExpression (value = 42) [42] : PsiType:int
|
||||
UMethod (name = getXs) [public static final fun getXs() : Z[] = UastEmptyExpression]
|
||||
UMethod (name = box) [public static final fun box() : java.lang.String {...}]
|
||||
UBlockExpression [{...}] : PsiType:Void
|
||||
UBinaryExpression (operator = =) [xs[0] = <init>(12)] : PsiType:void
|
||||
UArrayAccessExpression [xs[0]] : PsiType:int
|
||||
USimpleNameReferenceExpression (identifier = xs) [xs] : PsiType:Z[]
|
||||
ULiteralExpression (value = 0) [0] : PsiType:int
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) [<init>(12)] : PsiType:int
|
||||
UIdentifier (Identifier (Z)) [UIdentifier (Identifier (Z))]
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = PsiClass: Z) [<init>] : PsiType:int
|
||||
ULiteralExpression (value = 12) [12] : PsiType:int
|
||||
UDeclarationsExpression [var t: int = xs[0]]
|
||||
ULocalVariable (name = t) [var t: int = xs[0]]
|
||||
UArrayAccessExpression [xs[0]] : PsiType:int
|
||||
USimpleNameReferenceExpression (identifier = xs) [xs] : PsiType:Z[]
|
||||
ULiteralExpression (value = 0) [0] : PsiType:int
|
||||
UIfExpression [if (t.data != 12) throw <init>(t)] : PsiType:void
|
||||
UBinaryExpression (operator = !=) [t.data != 12] : PsiType:boolean
|
||||
UQualifiedReferenceExpression [t.data] : PsiType:int
|
||||
USimpleNameReferenceExpression (identifier = t) [t] : PsiType:int
|
||||
USimpleNameReferenceExpression (identifier = data) [data] : PsiType:int
|
||||
ULiteralExpression (value = 12) [12] : PsiType:int
|
||||
UThrowExpression [throw <init>(t)] : PsiType:Void
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) [<init>(t)] : PsiType:AssertionError
|
||||
UIdentifier (Identifier (AssertionError)) [UIdentifier (Identifier (AssertionError))]
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = PsiClass: AssertionError) [<init>] : PsiType:AssertionError
|
||||
USimpleNameReferenceExpression (identifier = t) [t] : PsiType:int
|
||||
UReturnExpression [return "OK"] : PsiType:Void
|
||||
ULiteralExpression (value = "OK") ["OK"] : PsiType:String
|
||||
UClass (name = Z) [public final class Z {...}]
|
||||
UMethod (name = getData) [public final fun getData() : int = UastEmptyExpression]
|
||||
@@ -0,0 +1,15 @@
|
||||
UFile (package = ) [public final class AccessArrayOfInlineClassKt {...]
|
||||
UClass (name = AccessArrayOfInlineClassKt) [public final class AccessArrayOfInlineClassKt {...}]
|
||||
UField (name = xs) [private static final var xs: Z[] = [!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
[!] UnknownKotlinExpression (CALL_EXPRESSION) [[!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
UMethod (name = getXs) [public static final fun getXs() : Z[] = UastEmptyExpression]
|
||||
UMethod (name = box) [public static final fun box() : java.lang.String {...}]
|
||||
UBlockExpression [{...}] : PsiType:Void
|
||||
[!] UnknownKotlinExpression (BINARY_EXPRESSION) [[!] UnknownKotlinExpression (BINARY_EXPRESSION)]
|
||||
[!] UnknownKotlinExpression (PROPERTY) [[!] UnknownKotlinExpression (PROPERTY)]
|
||||
UIfExpression [if ([!] UnknownKotlinExpression (BINARY_EXPRESSION)) throw [!] UnknownKotlinExpression (CALL_EXPRESSION)] : PsiType:Unit
|
||||
[!] UnknownKotlinExpression (BINARY_EXPRESSION) [[!] UnknownKotlinExpression (BINARY_EXPRESSION)]
|
||||
UThrowExpression [throw [!] UnknownKotlinExpression (CALL_EXPRESSION)] : PsiType:Void
|
||||
[!] UnknownKotlinExpression (CALL_EXPRESSION) [[!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
UReturnExpression [return "OK"] : PsiType:Void
|
||||
ULiteralExpression (value = "OK") ["OK"] : PsiType:String
|
||||
@@ -0,0 +1,24 @@
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun simpleIntArray(): Array<Int> = Array(3) { it }
|
||||
fun simpleDoubleArray(): Array<Double> = Array(3) { it.toDouble() + 0.1 }
|
||||
fun simpleStringArray(): Array<String> = Array(3) { it.toString() }
|
||||
|
||||
fun box(): String {
|
||||
val ia = simpleIntArray()
|
||||
assertEquals(0, ia[0])
|
||||
assertEquals(1, ia[1])
|
||||
assertEquals(2, ia[2])
|
||||
|
||||
val da = simpleDoubleArray()
|
||||
assertEquals(0.1, da[0])
|
||||
assertEquals(1.1, da[1])
|
||||
assertEquals(2.1, da[2])
|
||||
|
||||
val sa = simpleStringArray()
|
||||
assertEquals("0", sa[0])
|
||||
assertEquals("1", sa[1])
|
||||
assertEquals("2", sa[2])
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
UFile (package = ) [import kotlin.test.assertEquals...]
|
||||
UImportStatement (isOnDemand = false) [import kotlin.test.assertEquals]
|
||||
UClass (name = ArrayConstructorsSimpleKt) [public final class ArrayConstructorsSimpleKt {...}]
|
||||
UMethod (name = simpleIntArray) [public static final fun simpleIntArray() : java.lang.Integer[] {...}]
|
||||
UBlockExpression [{...}]
|
||||
UReturnExpression [return <init>(3, { var it: int ->...})]
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 2)) [<init>(3, { var it: int ->...})] : PsiType:Integer[]
|
||||
UIdentifier (Identifier (Array)) [UIdentifier (Identifier (Array))]
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = null) [<init>] : PsiType:Integer[]
|
||||
ULiteralExpression (value = 3) [3] : PsiType:int
|
||||
ULambdaExpression [{ var it: int ->...}] : PsiType:Function1<? super Integer, ? extends Integer>
|
||||
UParameter (name = it) [var it: int]
|
||||
UBlockExpression [{...}]
|
||||
UReturnExpression [return it]
|
||||
USimpleNameReferenceExpression (identifier = it) [it] : PsiType:int
|
||||
UMethod (name = simpleDoubleArray) [public static final fun simpleDoubleArray() : java.lang.Double[] {...}]
|
||||
UBlockExpression [{...}]
|
||||
UReturnExpression [return <init>(3, { var it: int ->...})]
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 2)) [<init>(3, { var it: int ->...})] : PsiType:Double[]
|
||||
UIdentifier (Identifier (Array)) [UIdentifier (Identifier (Array))]
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = null) [<init>] : PsiType:Double[]
|
||||
ULiteralExpression (value = 3) [3] : PsiType:int
|
||||
ULambdaExpression [{ var it: int ->...}] : PsiType:Function1<? super Integer, ? extends Double>
|
||||
UParameter (name = it) [var it: int]
|
||||
UBlockExpression [{...}]
|
||||
UReturnExpression [return it.toDouble() + 0.1]
|
||||
UBinaryExpression (operator = +) [it.toDouble() + 0.1] : PsiType:double
|
||||
UQualifiedReferenceExpression [it.toDouble()] : PsiType:double
|
||||
USimpleNameReferenceExpression (identifier = it) [it] : PsiType:int
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [toDouble()] : PsiType:double
|
||||
UIdentifier (Identifier (toDouble)) [UIdentifier (Identifier (toDouble))]
|
||||
USimpleNameReferenceExpression (identifier = toDouble, resolvesTo = null) [toDouble] : PsiType:double
|
||||
ULiteralExpression (value = 0.1) [0.1] : PsiType:double
|
||||
UMethod (name = simpleStringArray) [public static final fun simpleStringArray() : java.lang.String[] {...}]
|
||||
UBlockExpression [{...}]
|
||||
UReturnExpression [return <init>(3, { var it: int ->...})]
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 2)) [<init>(3, { var it: int ->...})] : PsiType:String[]
|
||||
UIdentifier (Identifier (Array)) [UIdentifier (Identifier (Array))]
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = null) [<init>] : PsiType:String[]
|
||||
ULiteralExpression (value = 3) [3] : PsiType:int
|
||||
ULambdaExpression [{ var it: int ->...}] : PsiType:Function1<? super Integer, ? extends String>
|
||||
UParameter (name = it) [var it: int]
|
||||
UBlockExpression [{...}]
|
||||
UReturnExpression [return it.toString()]
|
||||
UQualifiedReferenceExpression [it.toString()] : PsiType:String
|
||||
USimpleNameReferenceExpression (identifier = it) [it] : PsiType:int
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [toString()] : PsiType:String
|
||||
UIdentifier (Identifier (toString)) [UIdentifier (Identifier (toString))]
|
||||
USimpleNameReferenceExpression (identifier = toString, resolvesTo = null) [toString] : PsiType:String
|
||||
UMethod (name = box) [public static final fun box() : java.lang.String {...}]
|
||||
UBlockExpression [{...}] : PsiType:Void
|
||||
UDeclarationsExpression [var ia: java.lang.Integer[] = simpleIntArray()]
|
||||
ULocalVariable (name = ia) [var ia: java.lang.Integer[] = simpleIntArray()]
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [simpleIntArray()] : PsiType:Integer[]
|
||||
UIdentifier (Identifier (simpleIntArray)) [UIdentifier (Identifier (simpleIntArray))]
|
||||
USimpleNameReferenceExpression (identifier = simpleIntArray, resolvesTo = null) [simpleIntArray] : PsiType:Integer[]
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [assertEquals(0, ia[0])] : PsiType:void
|
||||
UIdentifier (Identifier (assertEquals)) [UIdentifier (Identifier (assertEquals))]
|
||||
USimpleNameReferenceExpression (identifier = assertEquals, resolvesTo = null) [assertEquals] : PsiType:void
|
||||
ULiteralExpression (value = 0) [0] : PsiType:int
|
||||
UArrayAccessExpression [ia[0]] : PsiType:int
|
||||
USimpleNameReferenceExpression (identifier = ia) [ia] : PsiType:Integer[]
|
||||
ULiteralExpression (value = 0) [0] : PsiType:int
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [assertEquals(1, ia[1])] : PsiType:void
|
||||
UIdentifier (Identifier (assertEquals)) [UIdentifier (Identifier (assertEquals))]
|
||||
USimpleNameReferenceExpression (identifier = assertEquals, resolvesTo = null) [assertEquals] : PsiType:void
|
||||
ULiteralExpression (value = 1) [1] : PsiType:int
|
||||
UArrayAccessExpression [ia[1]] : PsiType:int
|
||||
USimpleNameReferenceExpression (identifier = ia) [ia] : PsiType:Integer[]
|
||||
ULiteralExpression (value = 1) [1] : PsiType:int
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [assertEquals(2, ia[2])] : PsiType:void
|
||||
UIdentifier (Identifier (assertEquals)) [UIdentifier (Identifier (assertEquals))]
|
||||
USimpleNameReferenceExpression (identifier = assertEquals, resolvesTo = null) [assertEquals] : PsiType:void
|
||||
ULiteralExpression (value = 2) [2] : PsiType:int
|
||||
UArrayAccessExpression [ia[2]] : PsiType:int
|
||||
USimpleNameReferenceExpression (identifier = ia) [ia] : PsiType:Integer[]
|
||||
ULiteralExpression (value = 2) [2] : PsiType:int
|
||||
UDeclarationsExpression [var da: java.lang.Double[] = simpleDoubleArray()]
|
||||
ULocalVariable (name = da) [var da: java.lang.Double[] = simpleDoubleArray()]
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [simpleDoubleArray()] : PsiType:Double[]
|
||||
UIdentifier (Identifier (simpleDoubleArray)) [UIdentifier (Identifier (simpleDoubleArray))]
|
||||
USimpleNameReferenceExpression (identifier = simpleDoubleArray, resolvesTo = null) [simpleDoubleArray] : PsiType:Double[]
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [assertEquals(0.1, da[0])] : PsiType:void
|
||||
UIdentifier (Identifier (assertEquals)) [UIdentifier (Identifier (assertEquals))]
|
||||
USimpleNameReferenceExpression (identifier = assertEquals, resolvesTo = null) [assertEquals] : PsiType:void
|
||||
ULiteralExpression (value = 0.1) [0.1] : PsiType:double
|
||||
UArrayAccessExpression [da[0]] : PsiType:double
|
||||
USimpleNameReferenceExpression (identifier = da) [da] : PsiType:Double[]
|
||||
ULiteralExpression (value = 0) [0] : PsiType:int
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [assertEquals(1.1, da[1])] : PsiType:void
|
||||
UIdentifier (Identifier (assertEquals)) [UIdentifier (Identifier (assertEquals))]
|
||||
USimpleNameReferenceExpression (identifier = assertEquals, resolvesTo = null) [assertEquals] : PsiType:void
|
||||
ULiteralExpression (value = 1.1) [1.1] : PsiType:double
|
||||
UArrayAccessExpression [da[1]] : PsiType:double
|
||||
USimpleNameReferenceExpression (identifier = da) [da] : PsiType:Double[]
|
||||
ULiteralExpression (value = 1) [1] : PsiType:int
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [assertEquals(2.1, da[2])] : PsiType:void
|
||||
UIdentifier (Identifier (assertEquals)) [UIdentifier (Identifier (assertEquals))]
|
||||
USimpleNameReferenceExpression (identifier = assertEquals, resolvesTo = null) [assertEquals] : PsiType:void
|
||||
ULiteralExpression (value = 2.1) [2.1] : PsiType:double
|
||||
UArrayAccessExpression [da[2]] : PsiType:double
|
||||
USimpleNameReferenceExpression (identifier = da) [da] : PsiType:Double[]
|
||||
ULiteralExpression (value = 2) [2] : PsiType:int
|
||||
UDeclarationsExpression [var sa: java.lang.String[] = simpleStringArray()]
|
||||
ULocalVariable (name = sa) [var sa: java.lang.String[] = simpleStringArray()]
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [simpleStringArray()] : PsiType:String[]
|
||||
UIdentifier (Identifier (simpleStringArray)) [UIdentifier (Identifier (simpleStringArray))]
|
||||
USimpleNameReferenceExpression (identifier = simpleStringArray, resolvesTo = null) [simpleStringArray] : PsiType:String[]
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [assertEquals("0", sa[0])] : PsiType:void
|
||||
UIdentifier (Identifier (assertEquals)) [UIdentifier (Identifier (assertEquals))]
|
||||
USimpleNameReferenceExpression (identifier = assertEquals, resolvesTo = null) [assertEquals] : PsiType:void
|
||||
ULiteralExpression (value = "0") ["0"] : PsiType:String
|
||||
UArrayAccessExpression [sa[0]] : PsiType:String
|
||||
USimpleNameReferenceExpression (identifier = sa) [sa] : PsiType:String[]
|
||||
ULiteralExpression (value = 0) [0] : PsiType:int
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [assertEquals("1", sa[1])] : PsiType:void
|
||||
UIdentifier (Identifier (assertEquals)) [UIdentifier (Identifier (assertEquals))]
|
||||
USimpleNameReferenceExpression (identifier = assertEquals, resolvesTo = null) [assertEquals] : PsiType:void
|
||||
ULiteralExpression (value = "1") ["1"] : PsiType:String
|
||||
UArrayAccessExpression [sa[1]] : PsiType:String
|
||||
USimpleNameReferenceExpression (identifier = sa) [sa] : PsiType:String[]
|
||||
ULiteralExpression (value = 1) [1] : PsiType:int
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [assertEquals("2", sa[2])] : PsiType:void
|
||||
UIdentifier (Identifier (assertEquals)) [UIdentifier (Identifier (assertEquals))]
|
||||
USimpleNameReferenceExpression (identifier = assertEquals, resolvesTo = null) [assertEquals] : PsiType:void
|
||||
ULiteralExpression (value = "2") ["2"] : PsiType:String
|
||||
UArrayAccessExpression [sa[2]] : PsiType:String
|
||||
USimpleNameReferenceExpression (identifier = sa) [sa] : PsiType:String[]
|
||||
ULiteralExpression (value = 2) [2] : PsiType:int
|
||||
UReturnExpression [return "OK"] : PsiType:Void
|
||||
ULiteralExpression (value = "OK") ["OK"] : PsiType:String
|
||||
@@ -0,0 +1,31 @@
|
||||
UFile (package = ) [import kotlin.test.assertEquals...]
|
||||
UImportStatement (isOnDemand = false) [import kotlin.test.assertEquals]
|
||||
UClass (name = ArrayConstructorsSimpleKt) [public final class ArrayConstructorsSimpleKt {...}]
|
||||
UMethod (name = simpleIntArray) [public static final fun simpleIntArray() : java.lang.Integer[] {...}]
|
||||
UBlockExpression [{...}]
|
||||
UReturnExpression [return [!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
[!] UnknownKotlinExpression (CALL_EXPRESSION) [[!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
UMethod (name = simpleDoubleArray) [public static final fun simpleDoubleArray() : java.lang.Double[] {...}]
|
||||
UBlockExpression [{...}]
|
||||
UReturnExpression [return [!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
[!] UnknownKotlinExpression (CALL_EXPRESSION) [[!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
UMethod (name = simpleStringArray) [public static final fun simpleStringArray() : java.lang.String[] {...}]
|
||||
UBlockExpression [{...}]
|
||||
UReturnExpression [return [!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
[!] UnknownKotlinExpression (CALL_EXPRESSION) [[!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
UMethod (name = box) [public static final fun box() : java.lang.String {...}]
|
||||
UBlockExpression [{...}] : PsiType:Void
|
||||
[!] UnknownKotlinExpression (PROPERTY) [[!] UnknownKotlinExpression (PROPERTY)]
|
||||
[!] UnknownKotlinExpression (CALL_EXPRESSION) [[!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
[!] UnknownKotlinExpression (CALL_EXPRESSION) [[!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
[!] UnknownKotlinExpression (CALL_EXPRESSION) [[!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
[!] UnknownKotlinExpression (PROPERTY) [[!] UnknownKotlinExpression (PROPERTY)]
|
||||
[!] UnknownKotlinExpression (CALL_EXPRESSION) [[!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
[!] UnknownKotlinExpression (CALL_EXPRESSION) [[!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
[!] UnknownKotlinExpression (CALL_EXPRESSION) [[!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
[!] UnknownKotlinExpression (PROPERTY) [[!] UnknownKotlinExpression (PROPERTY)]
|
||||
[!] UnknownKotlinExpression (CALL_EXPRESSION) [[!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
[!] UnknownKotlinExpression (CALL_EXPRESSION) [[!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
[!] UnknownKotlinExpression (CALL_EXPRESSION) [[!] UnknownKotlinExpression (CALL_EXPRESSION)]
|
||||
UReturnExpression [return "OK"] : PsiType:Void
|
||||
ULiteralExpression (value = "OK") ["OK"] : PsiType:String
|
||||
@@ -0,0 +1,11 @@
|
||||
operator fun Array<String>.get(index1: Int, index2: Int) = this[index1 + index2]
|
||||
operator fun Array<String>.set(index1: Int, index2: Int, elem: String) {
|
||||
this[index1 + index2] = elem
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val s = Array<String>(1, { "" })
|
||||
s[1, -1] = "O"
|
||||
s[2, -2] += "K"
|
||||
return s[-3, 3]
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
UFile (package = ) [public final class ArrayGetAssignMultiIndexKt {...]
|
||||
UClass (name = ArrayGetAssignMultiIndexKt) [public final class ArrayGetAssignMultiIndexKt {...}]
|
||||
UMethod (name = get) [public static final fun get(@org.jetbrains.annotations.NotNull $this$get: java.lang.String[], @org.jetbrains.annotations.NotNull index1: int, @org.jetbrains.annotations.NotNull index2: int) : java.lang.String {...}]
|
||||
UParameter (name = $this$get) [@org.jetbrains.annotations.NotNull var $this$get: java.lang.String[]]
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
|
||||
UParameter (name = index1) [@org.jetbrains.annotations.NotNull var index1: int]
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
|
||||
UParameter (name = index2) [@org.jetbrains.annotations.NotNull var index2: int]
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
|
||||
UBlockExpression [{...}]
|
||||
UReturnExpression [return this[index1 + index2]]
|
||||
UArrayAccessExpression [this[index1 + index2]] : PsiType:String
|
||||
UThisExpression (label = null) [this] : PsiType:String[]
|
||||
UBinaryExpression (operator = +) [index1 + index2] : PsiType:int
|
||||
USimpleNameReferenceExpression (identifier = index1) [index1] : PsiType:int
|
||||
USimpleNameReferenceExpression (identifier = index2) [index2] : PsiType:int
|
||||
UMethod (name = set) [public static final fun set(@org.jetbrains.annotations.NotNull $this$set: java.lang.String[], @org.jetbrains.annotations.NotNull index1: int, @org.jetbrains.annotations.NotNull index2: int, @org.jetbrains.annotations.NotNull elem: java.lang.String) : void {...}]
|
||||
UParameter (name = $this$set) [@org.jetbrains.annotations.NotNull var $this$set: java.lang.String[]]
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
|
||||
UParameter (name = index1) [@org.jetbrains.annotations.NotNull var index1: int]
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
|
||||
UParameter (name = index2) [@org.jetbrains.annotations.NotNull var index2: int]
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
|
||||
UParameter (name = elem) [@org.jetbrains.annotations.NotNull var elem: java.lang.String]
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
|
||||
UBlockExpression [{...}] : PsiType:void
|
||||
UBinaryExpression (operator = =) [this[index1 + index2] = elem] : PsiType:void
|
||||
UArrayAccessExpression [this[index1 + index2]] : PsiType:String
|
||||
UThisExpression (label = null) [this] : PsiType:String[]
|
||||
UBinaryExpression (operator = +) [index1 + index2] : PsiType:int
|
||||
USimpleNameReferenceExpression (identifier = index1) [index1] : PsiType:int
|
||||
USimpleNameReferenceExpression (identifier = index2) [index2] : PsiType:int
|
||||
USimpleNameReferenceExpression (identifier = elem) [elem] : PsiType:String
|
||||
UMethod (name = box) [public static final fun box() : java.lang.String {...}]
|
||||
UBlockExpression [{...}] : PsiType:Void
|
||||
UDeclarationsExpression [var s: java.lang.String[] = <init>(1, { var it: int ->...})]
|
||||
ULocalVariable (name = s) [var s: java.lang.String[] = <init>(1, { var it: int ->...})]
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 2)) [<init>(1, { var it: int ->...})] : PsiType:String[]
|
||||
UIdentifier (Identifier (Array)) [UIdentifier (Identifier (Array))]
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = null) [<init>] : PsiType:String[]
|
||||
ULiteralExpression (value = 1) [1] : PsiType:int
|
||||
ULambdaExpression [{ var it: int ->...}] : PsiType:Function1<? super Integer, ? extends String>
|
||||
UParameter (name = it) [var it: int]
|
||||
UBlockExpression [{...}]
|
||||
UReturnExpression [return ""]
|
||||
ULiteralExpression (value = "") [""] : PsiType:String
|
||||
UBinaryExpression (operator = =) [s[1, -1] = "O"] : PsiType:void
|
||||
UArrayAccessExpression [s[1, -1]] : PsiType:String
|
||||
USimpleNameReferenceExpression (identifier = s) [s] : PsiType:String[]
|
||||
ULiteralExpression (value = 1) [1] : PsiType:int
|
||||
UPrefixExpression (operator = -) [-1] : PsiType:int
|
||||
ULiteralExpression (value = 1) [1] : PsiType:int
|
||||
ULiteralExpression (value = "O") ["O"] : PsiType:String
|
||||
UBinaryExpression (operator = +=) [s[2, -2] += "K"] : PsiType:void
|
||||
UArrayAccessExpression [s[2, -2]] : PsiType:String
|
||||
USimpleNameReferenceExpression (identifier = s) [s] : PsiType:String[]
|
||||
ULiteralExpression (value = 2) [2] : PsiType:int
|
||||
UPrefixExpression (operator = -) [-2] : PsiType:int
|
||||
ULiteralExpression (value = 2) [2] : PsiType:int
|
||||
ULiteralExpression (value = "K") ["K"] : PsiType:String
|
||||
UReturnExpression [return s[-3, 3]] : PsiType:Void
|
||||
UArrayAccessExpression [s[-3, 3]] : PsiType:String
|
||||
USimpleNameReferenceExpression (identifier = s) [s] : PsiType:String[]
|
||||
UPrefixExpression (operator = -) [-3] : PsiType:int
|
||||
ULiteralExpression (value = 3) [3] : PsiType:int
|
||||
ULiteralExpression (value = 3) [3] : PsiType:int
|
||||
@@ -0,0 +1,23 @@
|
||||
UFile (package = ) [public final class ArrayGetAssignMultiIndexKt {...]
|
||||
UClass (name = ArrayGetAssignMultiIndexKt) [public final class ArrayGetAssignMultiIndexKt {...}]
|
||||
UMethod (name = get) [public static final fun get($this$get: java.lang.String[], index1: int, index2: int) : java.lang.String {...}]
|
||||
UParameter (name = $this$get) [var $this$get: java.lang.String[]]
|
||||
UParameter (name = index1) [var index1: int]
|
||||
UParameter (name = index2) [var index2: int]
|
||||
UBlockExpression [{...}]
|
||||
UReturnExpression [return [!] UnknownKotlinExpression (ARRAY_ACCESS_EXPRESSION)]
|
||||
[!] UnknownKotlinExpression (ARRAY_ACCESS_EXPRESSION) [[!] UnknownKotlinExpression (ARRAY_ACCESS_EXPRESSION)]
|
||||
UMethod (name = set) [public static final fun set($this$set: java.lang.String[], index1: int, index2: int, elem: java.lang.String) : void {...}]
|
||||
UParameter (name = $this$set) [var $this$set: java.lang.String[]]
|
||||
UParameter (name = index1) [var index1: int]
|
||||
UParameter (name = index2) [var index2: int]
|
||||
UParameter (name = elem) [var elem: java.lang.String]
|
||||
UBlockExpression [{...}] : PsiType:Unit
|
||||
[!] UnknownKotlinExpression (BINARY_EXPRESSION) [[!] UnknownKotlinExpression (BINARY_EXPRESSION)]
|
||||
UMethod (name = box) [public static final fun box() : java.lang.String {...}]
|
||||
UBlockExpression [{...}] : PsiType:Void
|
||||
[!] UnknownKotlinExpression (PROPERTY) [[!] UnknownKotlinExpression (PROPERTY)]
|
||||
[!] UnknownKotlinExpression (BINARY_EXPRESSION) [[!] UnknownKotlinExpression (BINARY_EXPRESSION)]
|
||||
[!] UnknownKotlinExpression (BINARY_EXPRESSION) [[!] UnknownKotlinExpression (BINARY_EXPRESSION)]
|
||||
UReturnExpression [return [!] UnknownKotlinExpression (ARRAY_ACCESS_EXPRESSION)] : PsiType:Void
|
||||
[!] UnknownKotlinExpression (ARRAY_ACCESS_EXPRESSION) [[!] UnknownKotlinExpression (ARRAY_ACCESS_EXPRESSION)]
|
||||
Generated
+15
@@ -25,10 +25,25 @@ public class FE1UastTypesTestGenerated extends AbstractFE1UastTypesTest {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("accessArrayOfInlineClass.kt")
|
||||
public void testAccessArrayOfInlineClass() throws Exception {
|
||||
runTest("plugins/uast-kotlin-fir/testData/type/accessArrayOfInlineClass.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInType() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/uast-kotlin-fir/testData/type"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("arrayConstructorsSimple.kt")
|
||||
public void testArrayConstructorsSimple() throws Exception {
|
||||
runTest("plugins/uast-kotlin-fir/testData/type/arrayConstructorsSimple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("arrayGetAssignMultiIndex.kt")
|
||||
public void testArrayGetAssignMultiIndex() throws Exception {
|
||||
runTest("plugins/uast-kotlin-fir/testData/type/arrayGetAssignMultiIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeCast.kt")
|
||||
public void testTypeCast() throws Exception {
|
||||
runTest("plugins/uast-kotlin-fir/testData/type/typeCast.kt");
|
||||
|
||||
Generated
+15
@@ -25,10 +25,25 @@ public class FirUastTypesTestGenerated extends AbstractFirUastTypesTest {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("accessArrayOfInlineClass.kt")
|
||||
public void testAccessArrayOfInlineClass() throws Exception {
|
||||
runTest("plugins/uast-kotlin-fir/testData/type/accessArrayOfInlineClass.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInType() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/uast-kotlin-fir/testData/type"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("arrayConstructorsSimple.kt")
|
||||
public void testArrayConstructorsSimple() throws Exception {
|
||||
runTest("plugins/uast-kotlin-fir/testData/type/arrayConstructorsSimple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("arrayGetAssignMultiIndex.kt")
|
||||
public void testArrayGetAssignMultiIndex() throws Exception {
|
||||
runTest("plugins/uast-kotlin-fir/testData/type/arrayGetAssignMultiIndex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeCast.kt")
|
||||
public void testTypeCast() throws Exception {
|
||||
runTest("plugins/uast-kotlin-fir/testData/type/typeCast.kt");
|
||||
|
||||
Reference in New Issue
Block a user