diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 9e6ce66fe37..0e9ea883307 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -200,7 +200,9 @@ import org.jetbrains.kotlinx.serialization.AbstractSerializationPluginBytecodeLi import org.jetbrains.kotlinx.serialization.AbstractSerializationPluginDiagnosticTest import org.jetbrains.kotlinx.serialization.idea.AbstractSerializationPluginIdeDiagnosticTest import org.jetbrains.kotlinx.serialization.idea.AbstractSerializationQuickFixTest +import org.jetbrains.uast.test.kotlin.AbstractFE1LegacyUastDeclarationTest import org.jetbrains.uast.test.kotlin.AbstractFE1UastDeclarationTest +import org.jetbrains.uast.test.kotlin.AbstractFirLegacyUastDeclarationTest import org.jetbrains.uast.test.kotlin.AbstractFirUastDeclarationTest fun main(args: Array) { @@ -1847,14 +1849,24 @@ fun main(args: Array) { testGroup("plugins/uast-kotlin-fir/tests", "plugins/uast-kotlin-fir/testData") { testClass { model("declaration") - model("legacy") + } + } + + testGroup("plugins/uast-kotlin-fir/tests", "plugins/uast-kotlin/testData") { + testClass { + model("") } } testGroup("plugins/uast-kotlin-fir/tests", "plugins/uast-kotlin-fir/testData") { testClass { model("declaration") - model("legacy") + } + } + + testGroup("plugins/uast-kotlin-fir/tests", "plugins/uast-kotlin/testData") { + testClass { + model("") } } diff --git a/plugins/uast-kotlin-fir/testData/legacy/AnnotatedExpressions.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/AnnotatedExpressions.log.fe10.txt new file mode 100644 index 00000000000..c7c761fdab6 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/AnnotatedExpressions.log.fe10.txt @@ -0,0 +1,74 @@ +UFile (package = ) + UClass (name = AnnotatedExpressionsKt) + UMethod (name = foo) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UAnnotation (fqName = kotlin.Suppress) + UIdentifier (Identifier (foo)) + USimpleNameReferenceExpression (identifier = foo, resolvesTo = null) + UDeclarationsExpression + ULocalVariable (name = a) + UAnnotation (fqName = kotlin.Suppress) + ULiteralExpression (value = 1) + UDeclarationsExpression + ULocalVariable (name = b) + UAnnotation (fqName = kotlin.Suppress) + ULiteralExpression (value = 2) + UBinaryExpression (operator = =) + UAnnotation (fqName = kotlin.Suppress) + USimpleNameReferenceExpression (identifier = b) + USimpleNameReferenceExpression (identifier = a) + UIfExpression + UAnnotation (fqName = kotlin.Suppress) + UBinaryExpression (operator = >) + USimpleNameReferenceExpression (identifier = a) + ULiteralExpression (value = 2) + USimpleNameReferenceExpression (identifier = a) + USimpleNameReferenceExpression (identifier = b) + UDeclarationsExpression + ULocalVariable (name = c) + UExpressionList (elvis) + UDeclarationsExpression + ULocalVariable (name = varae5075f4) + USimpleNameReferenceExpression (identifier = a) + UAnnotation (fqName = kotlin.Suppress) + UIfExpression + UBinaryExpression (operator = !=) + USimpleNameReferenceExpression (identifier = varae5075f4) + ULiteralExpression (value = null) + USimpleNameReferenceExpression (identifier = varae5075f4) + USimpleNameReferenceExpression (identifier = b) + UMethod (name = annotatedSwitch) + UParameter (name = str) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + USwitchExpression + UExpressionList (when) + USwitchClauseExpressionWithBody + UQualifiedReferenceExpression + UAnnotation (fqName = kotlin.Suppress) + UNamedExpression (name = names) + ULiteralExpression (value = "DEPRECATION") + USimpleNameReferenceExpression (identifier = str) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (isBlank)) + USimpleNameReferenceExpression (identifier = isBlank, resolvesTo = null) + UExpressionList (when_entry) + UYieldExpression + ULiteralExpression (value = null) + USwitchClauseExpressionWithBody + UBinaryExpression (operator = !=) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = str) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (isNotEmpty)) + USimpleNameReferenceExpression (identifier = isNotEmpty, resolvesTo = null) + ULiteralExpression (value = null) + UExpressionList (when_entry) + UYieldExpression + ULiteralExpression (value = null) + USwitchClauseExpressionWithBody + UExpressionList (when_entry) + UYieldExpression + ULiteralExpression (value = 1) diff --git a/plugins/uast-kotlin-fir/testData/legacy/AnnotatedExpressions.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/AnnotatedExpressions.render.fe10.txt new file mode 100644 index 00000000000..b9e22540988 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/AnnotatedExpressions.render.fe10.txt @@ -0,0 +1,30 @@ +public final class AnnotatedExpressionsKt { + public static final fun foo() : void { + foo() + @kotlin.Suppress var a: int = 1 + @kotlin.Suppress var b: int = 2 + b = a + if (a > 2) a else b + var c: int = elvis { + var varae5075f4: int = a + if (varae5075f4 != null) varae5075f4 else b + } + } + public static final fun annotatedSwitch(@org.jetbrains.annotations.NotNull str: java.lang.String) : java.lang.Integer { + return switch { + str.isBlank() -> { + yield null + } + + str.isNotEmpty() != null -> { + yield null + } + + -> { + yield 1 + } + + } + + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/AnnotationComplex.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/AnnotationComplex.log.fe10.txt new file mode 100644 index 00000000000..9760eb33323 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/AnnotationComplex.log.fe10.txt @@ -0,0 +1,49 @@ +UFile (package = ) + UClass (name = Annotation) + UAnnotationMethod (name = strings) + UClass (name = A) + UAnnotation (fqName = Annotation) + UMethod (name = A) + UClass (name = AnnotationInner) + UAnnotationMethod (name = value) + UClass (name = B1) + UAnnotation (fqName = AnnotationArray) + UNamedExpression (name = value) + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) + UIdentifier (Identifier (Annotation)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: Annotation) + UMethod (name = B1) + UClass (name = B2) + UAnnotation (fqName = AnnotationArray) + UNamedExpression (name = value) + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 2)) + UIdentifier (Identifier (Annotation)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: Annotation) + ULiteralExpression (value = "sv1") + ULiteralExpression (value = "sv2") + UMethod (name = B2) + UClass (name = AnnotationArray) + UAnnotationMethod (name = value) + UClass (name = C) + UAnnotation (fqName = AnnotationArray) + UNamedExpression (name = value) + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) + UIdentifier (Identifier (Annotation)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: Annotation) + UCallExpression (kind = UastCallKind(name='array_initializer'), argCount = 2)) + UIdentifier (Identifier (arrayOf)) + USimpleNameReferenceExpression (identifier = arrayOf, resolvesTo = null) + ULiteralExpression (value = "sar1") + ULiteralExpression (value = "sar2") + UMethod (name = C) + UClass (name = C2) + UAnnotation (fqName = AnnotationArray) + UNamedExpression (name = value) + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) + UIdentifier (Identifier (Annotation)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: Annotation) + UCallExpression (kind = UastCallKind(name='array_initializer'), argCount = 2)) + UIdentifier (Identifier ([)) + ULiteralExpression (value = "[sar]1") + ULiteralExpression (value = "[sar]2") + UMethod (name = C2) diff --git a/plugins/uast-kotlin-fir/testData/legacy/AnnotationComplex.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/AnnotationComplex.render.fe10.txt new file mode 100644 index 00000000000..87b57fda535 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/AnnotationComplex.render.fe10.txt @@ -0,0 +1,31 @@ +public abstract annotation Annotation { + public abstract fun strings() : java.lang.String[] = UastEmptyExpression +} + +public final class A { + public fun A() = UastEmptyExpression +} + +public abstract annotation AnnotationInner { + public abstract fun value() : Annotation = UastEmptyExpression +} + +public final class B1 { + public fun B1() = UastEmptyExpression +} + +public final class B2 { + public fun B2() = UastEmptyExpression +} + +public abstract annotation AnnotationArray { + public abstract fun value() : Annotation[] = UastEmptyExpression +} + +public final class C { + public fun C() = UastEmptyExpression +} + +public final class C2 { + public fun C2() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/AnnotationParameters.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/AnnotationParameters.log.fe10.txt new file mode 100644 index 00000000000..fe14237f6a7 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/AnnotationParameters.log.fe10.txt @@ -0,0 +1,72 @@ +UFile (package = ) + UClass (name = AnnotationParametersKt) + UMethod (name = foo) + UAnnotation (fqName = RequiresPermission) + UNamedExpression (name = anyOf) + UCallExpression (kind = UastCallKind(name='array_initializer'), argCount = 3)) + UIdentifier (Identifier (intArrayOf)) + USimpleNameReferenceExpression (identifier = intArrayOf, resolvesTo = null) + ULiteralExpression (value = 1) + ULiteralExpression (value = 2) + ULiteralExpression (value = 3) + UAnnotation (fqName = IntRange) + UNamedExpression (name = from) + ULiteralExpression (value = 10) + UNamedExpression (name = to) + ULiteralExpression (value = 0) + UAnnotation (fqName = WithDefaultValue) + UAnnotation (fqName = SuppressLint) + UNamedExpression (name = value) + ULiteralExpression (value = "Lorem") + UBlockExpression + UReturnExpression + ULiteralExpression (value = 5) + UMethod (name = bar) + UAnnotation (fqName = IntRange) + UNamedExpression (name = from) + ULiteralExpression (value = 0) + UNamedExpression (name = to) + ULiteralExpression (value = 100) + UAnnotation (fqName = SuppressLint) + UNamedExpression (name = value) + UCallExpression (kind = UastCallKind(name='array_initializer'), argCount = 3)) + ULiteralExpression (value = "Lorem") + ULiteralExpression (value = "Ipsum") + ULiteralExpression (value = "Dolor") + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = Unit) + UMethod (name = fooWithArrLiteral) + UAnnotation (fqName = RequiresPermission) + UNamedExpression (name = anyOf) + UCallExpression (kind = UastCallKind(name='array_initializer'), argCount = 3)) + UIdentifier (Identifier ([)) + ULiteralExpression (value = 1) + ULiteralExpression (value = 2) + ULiteralExpression (value = 3) + UBlockExpression + UReturnExpression + ULiteralExpression (value = 5) + UMethod (name = fooWithStrArrLiteral) + UAnnotation (fqName = RequiresStrPermission) + UNamedExpression (name = strs) + UCallExpression (kind = UastCallKind(name='array_initializer'), argCount = 3)) + UIdentifier (Identifier ([)) + ULiteralExpression (value = "a") + ULiteralExpression (value = "b") + ULiteralExpression (value = "c") + UBlockExpression + UReturnExpression + ULiteralExpression (value = 3) + UClass (name = IntRange) + UAnnotationMethod (name = from) + UAnnotationMethod (name = to) + UClass (name = RequiresPermission) + UAnnotationMethod (name = anyOf) + UClass (name = RequiresStrPermission) + UAnnotationMethod (name = strs) + UClass (name = WithDefaultValue) + UAnnotationMethod (name = value) + ULiteralExpression (value = 42) + UClass (name = SuppressLint) + UAnnotationMethod (name = value) diff --git a/plugins/uast-kotlin-fir/testData/legacy/AnnotationParameters.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/AnnotationParameters.render.fe10.txt new file mode 100644 index 00000000000..3c29047036b --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/AnnotationParameters.render.fe10.txt @@ -0,0 +1,43 @@ +public final class AnnotationParametersKt { + @RequiresPermission(anyOf = intArrayOf(1, 2, 3)) + @IntRange(from = 10, to = 0) + @WithDefaultValue + @SuppressLint(value = "Lorem") + public static final fun foo() : int { + return 5 + } + @IntRange(from = 0, to = 100) + @SuppressLint(value = ("Lorem", "Ipsum", "Dolor")) + public static final fun bar() : void { + return Unit + } + @RequiresPermission(anyOf = collectionLiteral[1, 2, 3]) + public static final fun fooWithArrLiteral() : int { + return 5 + } + @RequiresStrPermission(strs = collectionLiteral["a", "b", "c"]) + public static final fun fooWithStrArrLiteral() : int { + return 3 + } +} + +public abstract annotation IntRange { + public abstract fun from() : long = UastEmptyExpression + public abstract fun to() : long = UastEmptyExpression +} + +public abstract annotation RequiresPermission { + public abstract fun anyOf() : int[] = UastEmptyExpression +} + +public abstract annotation RequiresStrPermission { + public abstract fun strs() : java.lang.String[] = UastEmptyExpression +} + +public abstract annotation WithDefaultValue { + public abstract fun value() : int = UastEmptyExpression +} + +public abstract annotation SuppressLint { + public abstract fun value() : java.lang.String[] = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/Anonymous.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Anonymous.log.fe10.txt new file mode 100644 index 00000000000..295a6fc2dea --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Anonymous.log.fe10.txt @@ -0,0 +1,59 @@ +UFile (package = ) + UImportStatement (isOnDemand = false) + UImportStatement (isOnDemand = false) + UClass (name = AnonymousKt) + UMethod (name = foo) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = runnable) + UObjectLiteralExpression + UClass (name = null) + UMethod (name = run) + UBlockExpression + UMethod (name = ) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = runnable) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (run)) + USimpleNameReferenceExpression (identifier = run, resolvesTo = null) + UDeclarationsExpression + ULocalVariable (name = runnable2) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (Runnable)) + USimpleNameReferenceExpression (identifier = Runnable, resolvesTo = PsiClass: Runnable) + ULambdaExpression + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (println)) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = runnable2) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (run)) + USimpleNameReferenceExpression (identifier = run, resolvesTo = null) + UDeclarationsExpression + ULocalVariable (name = closeableRunnable) + UObjectLiteralExpression + UClass (name = null) + UMethod (name = close) + UBlockExpression + UMethod (name = run) + UBlockExpression + UMethod (name = ) + UDeclarationsExpression + ULocalVariable (name = runnableIs) + UObjectLiteralExpression + UClass (name = null) + UMethod (name = read) + UBlockExpression + UReturnExpression + ULiteralExpression (value = 0) + UMethod (name = run) + UBlockExpression + UMethod (name = ) + UMethod (name = withErr) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = runnable) + UObjectLiteralExpression + UClass (name = ) diff --git a/plugins/uast-kotlin-fir/testData/legacy/Anonymous.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Anonymous.render.fe10.txt new file mode 100644 index 00000000000..bb2e36e3b69 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Anonymous.render.fe10.txt @@ -0,0 +1,18 @@ +import java.io.Closeable +import java.io.InputStream + +public final class AnonymousKt { + public static final fun foo() : void { + var runnable: = anonymous object : Runnable { override fun run() {} } + runnable.run() + var runnable2: java.lang.Runnable = Runnable({ + println() + }) + runnable2.run() + var closeableRunnable: = anonymous object : Runnable, Closeable { override fun close() {} override fun run() {} } + var runnableIs: = anonymous object : InputStream(), Runnable { override fun read(): Int = 0; override fun run() {} } + } + public static final fun withErr() : void { + var runnable: = anonymous null + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/Assertion.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Assertion.log.fe10.txt new file mode 100644 index 00000000000..2d6357e3c74 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Assertion.log.fe10.txt @@ -0,0 +1,10 @@ +UFile (package = ) + UClass (name = AssertionKt) + UMethod (name = foo) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = s) + ULiteralExpression (value = "Not Null") + UReturnExpression + UPostfixExpression (operator = !!) + USimpleNameReferenceExpression (identifier = s) diff --git a/plugins/uast-kotlin-fir/testData/legacy/Assertion.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Assertion.render.fe10.txt new file mode 100644 index 00000000000..3a1392f5e3d --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Assertion.render.fe10.txt @@ -0,0 +1,6 @@ +public final class AssertionKt { + public static final fun foo() : java.lang.String { + var s: java.lang.String = "Not Null" + return s!! + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/Bitwise.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Bitwise.log.fe10.txt new file mode 100644 index 00000000000..4571d798fcc --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Bitwise.log.fe10.txt @@ -0,0 +1,98 @@ +UFile (package = ) + UClass (name = BitwiseKt) + UMethod (name = foo) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = mask) + ULiteralExpression (value = 127) + UDeclarationsExpression + ULocalVariable (name = x) + ULiteralExpression (value = 2863311530) + UDeclarationsExpression + ULocalVariable (name = pos) + UBinaryExpression (operator = &) + USimpleNameReferenceExpression (identifier = x) + USimpleNameReferenceExpression (identifier = mask) + UDeclarationsExpression + ULocalVariable (name = max) + UBinaryExpression (operator = |) + USimpleNameReferenceExpression (identifier = x) + USimpleNameReferenceExpression (identifier = mask) + UDeclarationsExpression + ULocalVariable (name = zebra) + UBinaryExpression (operator = ^) + USimpleNameReferenceExpression (identifier = x) + USimpleNameReferenceExpression (identifier = mask) + UDeclarationsExpression + ULocalVariable (name = signed) + UBinaryExpression (operator = >>) + USimpleNameReferenceExpression (identifier = x) + ULiteralExpression (value = 2) + UDeclarationsExpression + ULocalVariable (name = one) + UBinaryExpression (operator = >>>) + USimpleNameReferenceExpression (identifier = x) + ULiteralExpression (value = 31) + UDeclarationsExpression + ULocalVariable (name = zero) + UBinaryExpression (operator = <<) + USimpleNameReferenceExpression (identifier = x) + ULiteralExpression (value = 32) + UReturnExpression + UBinaryExpression (operator = -) + UBinaryExpression (operator = +) + USimpleNameReferenceExpression (identifier = pos) + USimpleNameReferenceExpression (identifier = zero) + UBinaryExpression (operator = /) + UBinaryExpression (operator = *) + USimpleNameReferenceExpression (identifier = zebra) + USimpleNameReferenceExpression (identifier = signed) + USimpleNameReferenceExpression (identifier = one) + UMethod (name = bar) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = mask) + ULiteralExpression (value = 127) + UDeclarationsExpression + ULocalVariable (name = x) + ULiteralExpression (value = 6148914691236517205) + UDeclarationsExpression + ULocalVariable (name = pos) + UBinaryExpression (operator = &) + USimpleNameReferenceExpression (identifier = x) + USimpleNameReferenceExpression (identifier = mask) + UDeclarationsExpression + ULocalVariable (name = max) + UBinaryExpression (operator = |) + USimpleNameReferenceExpression (identifier = x) + USimpleNameReferenceExpression (identifier = mask) + UDeclarationsExpression + ULocalVariable (name = zebra) + UBinaryExpression (operator = ^) + USimpleNameReferenceExpression (identifier = x) + USimpleNameReferenceExpression (identifier = mask) + UDeclarationsExpression + ULocalVariable (name = signed) + UBinaryExpression (operator = >>) + USimpleNameReferenceExpression (identifier = x) + ULiteralExpression (value = 2) + UDeclarationsExpression + ULocalVariable (name = one) + UBinaryExpression (operator = >>>) + USimpleNameReferenceExpression (identifier = x) + ULiteralExpression (value = 63) + UDeclarationsExpression + ULocalVariable (name = zero) + UBinaryExpression (operator = <<) + USimpleNameReferenceExpression (identifier = x) + ULiteralExpression (value = 64) + UReturnExpression + UBinaryExpression (operator = -) + UBinaryExpression (operator = +) + USimpleNameReferenceExpression (identifier = pos) + USimpleNameReferenceExpression (identifier = zero) + UBinaryExpression (operator = /) + UBinaryExpression (operator = *) + USimpleNameReferenceExpression (identifier = zebra) + USimpleNameReferenceExpression (identifier = signed) + USimpleNameReferenceExpression (identifier = one) diff --git a/plugins/uast-kotlin-fir/testData/legacy/Bitwise.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Bitwise.render.fe10.txt new file mode 100644 index 00000000000..782a24b4390 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Bitwise.render.fe10.txt @@ -0,0 +1,24 @@ +public final class BitwiseKt { + public static final fun foo() : int { + var mask: int = 127 + var x: int = 2863311530 + var pos: int = x & mask + var max: int = x | mask + var zebra: int = x ^ mask + var signed: int = x >> 2 + var one: int = x >>> 31 + var zero: int = x << 32 + return pos + zero - zebra * signed / one + } + public static final fun bar() : long { + var mask: long = 127 + var x: long = 6148914691236517205 + var pos: long = x & mask + var max: long = x | mask + var zebra: long = x ^ mask + var signed: long = x >> 2 + var one: long = x >>> 63 + var zero: long = x << 64 + return pos + zero - zebra * signed / one + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/BrokenMethod.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/BrokenMethod.log.fe10.txt new file mode 100644 index 00000000000..add744dd493 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/BrokenMethod.log.fe10.txt @@ -0,0 +1,52 @@ +UFile (package = ) + UClass (name = BrokenMethodKt) + UMethod (name = main) + UParameter (name = args) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UDeclarationsExpression + UClass (name = TestUsed) + UField (name = parameter) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UMethod (name = getParameter) + UMethod (name = TestUsed) + UParameter (name = parameter) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UMethod (name = component1) + UMethod (name = copy) + UParameter (name = parameter) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UMethod (name = toString) + UMethod (name = hashCode) + UMethod (name = equals) + UParameter (name = other) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UClass (name = Used) + UField (name = Companion) + UAnnotation (fqName = null) + UField (name = parameter) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UMethod (name = getParameter) + UMethod (name = Used) + UParameter (name = parameter) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UMethod (name = component1) + UMethod (name = copy) + UParameter (name = parameter) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UMethod (name = toString) + UMethod (name = hashCode) + UMethod (name = equals) + UParameter (name = other) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UClass (name = Companion) + UMethod (name = doStuff1) + UParameter (name = $this$doStuff1) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) + UIdentifier (Identifier (Used)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: Used) + UThisExpression (label = null) + UMethod (name = Companion) diff --git a/plugins/uast-kotlin-fir/testData/legacy/BrokenMethod.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/BrokenMethod.render.fe10.txt new file mode 100644 index 00000000000..8af77dae24b --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/BrokenMethod.render.fe10.txt @@ -0,0 +1,31 @@ +public final class BrokenMethodKt { + public static final fun main(@org.jetbrains.annotations.NotNull args: java.lang.String[]) : void { + public static final class TestUsed { + @org.jetbrains.annotations.NotNull private final var parameter: java.lang.CharSequence + public final fun getParameter() : java.lang.CharSequence = UastEmptyExpression + public fun TestUsed(@org.jetbrains.annotations.NotNull parameter: java.lang.CharSequence) = UastEmptyExpression + public final fun component1() : java.lang.CharSequence = UastEmptyExpression + public final fun copy(@org.jetbrains.annotations.NotNull parameter: java.lang.CharSequence) : TestUsed = UastEmptyExpression + public fun toString() : java.lang.String = UastEmptyExpression + public fun hashCode() : int = UastEmptyExpression + public fun equals(@org.jetbrains.annotations.Nullable other: java.lang.Object) : boolean = UastEmptyExpression + private static final class Used { + @null public static final var Companion: Companion + @org.jetbrains.annotations.NotNull private final var parameter: java.lang.Object + public final fun getParameter() : java.lang.Object = UastEmptyExpression + public fun Used(@org.jetbrains.annotations.NotNull parameter: java.lang.Object) = UastEmptyExpression + public final fun component1() : java.lang.Object = UastEmptyExpression + public final fun copy(@org.jetbrains.annotations.NotNull parameter: java.lang.Object) : Used = UastEmptyExpression + public fun toString() : java.lang.String = UastEmptyExpression + public fun hashCode() : int = UastEmptyExpression + public fun equals(@org.jetbrains.annotations.Nullable other: java.lang.Object) : boolean = UastEmptyExpression + public static final class Companion { + public final fun doStuff1(@org.jetbrains.annotations.NotNull $this$doStuff1: java.lang.Object) : Used { + return (this) + } + private fun Companion() = UastEmptyExpression + } + } + } + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/ClassAnnotation.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ClassAnnotation.log.fe10.txt new file mode 100644 index 00000000000..fce8469ccd1 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ClassAnnotation.log.fe10.txt @@ -0,0 +1,30 @@ +UFile (package = ) + UClass (name = A) + UAnnotation (fqName = null) + UMethod (name = A) + UClass (name = MyAnnotation) + UAnnotationMethod (name = text) + UClass (name = B) + UAnnotation (fqName = MyAnnotation) + UNamedExpression (name = text) + ULiteralExpression (value = "class") + UField (name = Companion) + UAnnotation (fqName = null) + UMethod (name = B) + UClass (name = InB) + UAnnotation (fqName = MyAnnotation) + UNamedExpression (name = text) + ULiteralExpression (value = "inB class") + UMethod (name = InB) + UClass (name = Companion) + UAnnotation (fqName = MyAnnotation) + UNamedExpression (name = text) + ULiteralExpression (value = "companion") + UMethod (name = Companion) + UClass (name = Obj) + UAnnotation (fqName = MyAnnotation) + UNamedExpression (name = text) + ULiteralExpression (value = "object") + UField (name = INSTANCE) + UAnnotation (fqName = null) + UMethod (name = Obj) diff --git a/plugins/uast-kotlin-fir/testData/legacy/ClassAnnotation.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ClassAnnotation.render.fe10.txt new file mode 100644 index 00000000000..f7a5a5ccced --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ClassAnnotation.render.fe10.txt @@ -0,0 +1,23 @@ +public final class A { + public fun A() = UastEmptyExpression +} + +public abstract annotation MyAnnotation { + public abstract fun text() : java.lang.String = UastEmptyExpression +} + +public final class B { + @null public static final var Companion: B.Companion + public fun B() = UastEmptyExpression + public static final class InB { + public fun InB() = UastEmptyExpression + } + public static final class Companion { + private fun Companion() = UastEmptyExpression + } +} + +public final class Obj { + @null public static final var INSTANCE: Obj + private fun Obj() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/ConstructorDelegate.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ConstructorDelegate.log.fe10.txt new file mode 100644 index 00000000000..360f0670c5a --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ConstructorDelegate.log.fe10.txt @@ -0,0 +1,39 @@ +UFile (package = ) + UClass (name = ConstructorDelegateKt) + UMethod (name = createBase) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) + UIdentifier (Identifier (BaseImpl)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: BaseImpl) + USimpleNameReferenceExpression (identifier = i) + UClass (name = Base) + UMethod (name = print) + UClass (name = BaseImpl) + UField (name = x) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UMethod (name = print) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (print)) + USimpleNameReferenceExpression (identifier = print, resolvesTo = null) + USimpleNameReferenceExpression (identifier = x) + UMethod (name = getX) + UMethod (name = BaseImpl) + UParameter (name = x) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UClass (name = Derived) + UExpressionList (super_delegation) + UTypeReferenceExpression (name = Base) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (createBase)) + USimpleNameReferenceExpression (identifier = createBase, resolvesTo = null) + ULiteralExpression (value = 10) + UExpressionList (super_delegation) + UTypeReferenceExpression (name = java.lang.CharSequence) + ULiteralExpression (value = "abc") + UMethod (name = Derived) + UParameter (name = b) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) diff --git a/plugins/uast-kotlin-fir/testData/legacy/ConstructorDelegate.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ConstructorDelegate.render.fe10.txt new file mode 100644 index 00000000000..f5e3585dfff --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ConstructorDelegate.render.fe10.txt @@ -0,0 +1,22 @@ +public final class ConstructorDelegateKt { + public static final fun createBase(@org.jetbrains.annotations.NotNull i: int) : Base { + return (i) + } +} + +public abstract interface Base { + public abstract fun print() : void = UastEmptyExpression +} + +public final class BaseImpl : Base { + @org.jetbrains.annotations.NotNull private final var x: int + public fun print() : void { + print(x) + } + public final fun getX() : int = UastEmptyExpression + public fun BaseImpl(@org.jetbrains.annotations.NotNull x: int) = UastEmptyExpression +} + +public final class Derived : Base, java.lang.CharSequence { + public fun Derived(@org.jetbrains.annotations.NotNull b: Base) = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/Constructors.kt b/plugins/uast-kotlin-fir/testData/legacy/Constructors.kt deleted file mode 100644 index 728ba7aee4c..00000000000 --- a/plugins/uast-kotlin-fir/testData/legacy/Constructors.kt +++ /dev/null @@ -1,81 +0,0 @@ -class A(val str: String) { - - constructor(i: Int) : this(i.toString()) - -} - -class AWithInit(val str: String) { - - init { - println() - } - - constructor(i: Int) : this(i.toString()) - -} - -class AWith2Init(val str: String) { - - init { - println(1) - } - - init { - println(2) - } - - constructor(i: Int) : this(i.toString()) - -} - -class AOnlyInit { - - init { - println(1) - } - - init { - println(2) - } -} - -class AWithSecondary { - - lateinit var a: String - - constructor(i: Int) { - a = i.toString() - } - - constructor(s: String) { - a = s - } - -} - -class AWithSecondaryInit { - - lateinit var a: String - - init { - println() - } - - constructor(i: Int) { - a = i.toString() - } - - constructor(s: String) { - a = s - var local: String = s - local.toString() - } - -} - -class AWithFieldInit(i: Int) { - val a: String - init { - a = i.toString() - } -} diff --git a/plugins/uast-kotlin-fir/testData/legacy/CycleInTypeParameters.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/CycleInTypeParameters.log.fe10.txt new file mode 100644 index 00000000000..c6e820cf1c7 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/CycleInTypeParameters.log.fe10.txt @@ -0,0 +1,10 @@ +UFile (package = ) + UClass (name = CycleInTypeParametersKt) + UField (name = a) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UBinaryExpressionWithType + ULiteralExpression (value = null) + UTypeReferenceExpression (name = Device) + UMethod (name = getA) + UClass (name = Device) + UMethod (name = Device) diff --git a/plugins/uast-kotlin-fir/testData/legacy/CycleInTypeParameters.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/CycleInTypeParameters.render.fe10.txt new file mode 100644 index 00000000000..a527bb3c8c1 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/CycleInTypeParameters.render.fe10.txt @@ -0,0 +1,8 @@ +public final class CycleInTypeParametersKt { + @org.jetbrains.annotations.Nullable private static final var a: Device = null as? Device + public static final fun getA() : Device = UastEmptyExpression +} + +public final class Device { + public fun Device() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/DefaultImpls.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/DefaultImpls.log.fe10.txt new file mode 100644 index 00000000000..571591722f8 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/DefaultImpls.log.fe10.txt @@ -0,0 +1,8 @@ +UFile (package = ) + UClass (name = Foo) + UMethod (name = bar) + UBlockExpression + UReturnExpression + ULiteralExpression (value = "Hello!") + UClass (name = Baz) + UMethod (name = Baz) diff --git a/plugins/uast-kotlin-fir/testData/legacy/DefaultImpls.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/DefaultImpls.render.fe10.txt new file mode 100644 index 00000000000..351397067ed --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/DefaultImpls.render.fe10.txt @@ -0,0 +1,9 @@ +public abstract interface Foo { + public default fun bar() : java.lang.String { + return "Hello!" + } +} + +public final class Baz : Foo { + public fun Baz() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/DefaultParameterValues.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/DefaultParameterValues.log.fe10.txt new file mode 100644 index 00000000000..11a9a0fb43d --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/DefaultParameterValues.log.fe10.txt @@ -0,0 +1,10 @@ +UFile (package = ) + UClass (name = DefaultParameterValuesKt) + UMethod (name = foo) + UParameter (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = 1) + UParameter (name = foo) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + ULiteralExpression (value = null) + UBlockExpression diff --git a/plugins/uast-kotlin-fir/testData/legacy/DefaultParameterValues.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/DefaultParameterValues.render.fe10.txt new file mode 100644 index 00000000000..02a2140841f --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/DefaultParameterValues.render.fe10.txt @@ -0,0 +1,4 @@ +public final class DefaultParameterValuesKt { + public static final fun foo(@org.jetbrains.annotations.NotNull a: int, @org.jetbrains.annotations.Nullable foo: java.lang.String) : void { + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/Delegate.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Delegate.log.fe10.txt new file mode 100644 index 00000000000..a0b9d104ca6 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Delegate.log.fe10.txt @@ -0,0 +1,59 @@ +UFile (package = ) + UClass (name = MyColor) + UField (name = x) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UField (name = y) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UField (name = z) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UMethod (name = getX) + UMethod (name = getY) + UMethod (name = getZ) + UMethod (name = MyColor) + UParameter (name = x) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = y) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = z) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UClass (name = Some) + UField (name = delegate$delegate) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (lazy)) + USimpleNameReferenceExpression (identifier = lazy, resolvesTo = null) + ULambdaExpression + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 3)) + UIdentifier (Identifier (MyColor)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: MyColor) + ULiteralExpression (value = 18) + ULiteralExpression (value = 2) + ULiteralExpression (value = 3) + UField (name = lambda) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (lazy)) + USimpleNameReferenceExpression (identifier = lazy, resolvesTo = null) + ULambdaExpression + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 3)) + UIdentifier (Identifier (MyColor)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: MyColor) + ULiteralExpression (value = 1) + ULiteralExpression (value = 2) + ULiteralExpression (value = 3) + UField (name = nonLazy) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 3)) + UIdentifier (Identifier (MyColor)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: MyColor) + ULiteralExpression (value = 1) + ULiteralExpression (value = 2) + ULiteralExpression (value = 3) + UMethod (name = getDelegate) + UMethod (name = getLambda) + UMethod (name = getNonLazy) + UMethod (name = Some) diff --git a/plugins/uast-kotlin-fir/testData/legacy/Delegate.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Delegate.render.fe10.txt new file mode 100644 index 00000000000..0b50ead54f0 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Delegate.render.fe10.txt @@ -0,0 +1,21 @@ +public final class MyColor { + @org.jetbrains.annotations.NotNull private final var x: int + @org.jetbrains.annotations.NotNull private final var y: int + @org.jetbrains.annotations.NotNull private final var z: int + public final fun getX() : int = UastEmptyExpression + public final fun getY() : int = UastEmptyExpression + public final fun getZ() : int = UastEmptyExpression + public fun MyColor(@org.jetbrains.annotations.NotNull x: int, @org.jetbrains.annotations.NotNull y: int, @org.jetbrains.annotations.NotNull z: int) = UastEmptyExpression +} + +public final class Some { + @org.jetbrains.annotations.NotNull private final var delegate$delegate: kotlin.Lazy + @org.jetbrains.annotations.NotNull private final var lambda: kotlin.Lazy = lazy({ + return (1, 2, 3) + }) + @org.jetbrains.annotations.NotNull private final var nonLazy: MyColor = (1, 2, 3) + public final fun getDelegate() : MyColor = UastEmptyExpression + public final fun getLambda() : kotlin.Lazy = UastEmptyExpression + public final fun getNonLazy() : MyColor = UastEmptyExpression + public fun Some() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/DeprecatedHidden.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/DeprecatedHidden.log.fe10.txt new file mode 100644 index 00000000000..201285b464b --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/DeprecatedHidden.log.fe10.txt @@ -0,0 +1,14 @@ +UFile (package = test.pkg) + UClass (name = Test) + UMethod (name = test1) + UBlockExpression + UMethod (name = Test) + UMethod (name = test2) + UAnnotation (fqName = kotlin.Deprecated) + UNamedExpression (name = level) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = DeprecationLevel) + USimpleNameReferenceExpression (identifier = HIDDEN) + UNamedExpression (name = message) + ULiteralExpression (value = "nothing") + UBlockExpression diff --git a/plugins/uast-kotlin-fir/testData/legacy/DeprecatedHidden.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/DeprecatedHidden.render.fe10.txt new file mode 100644 index 00000000000..b0fae3381ab --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/DeprecatedHidden.render.fe10.txt @@ -0,0 +1,10 @@ +package test.pkg + +public final class Test { + public final fun test1() : void { + } + public fun Test() = UastEmptyExpression + @kotlin.Deprecated(level = DeprecationLevel.HIDDEN, message = "nothing") + fun test2() : void { + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/DestructuringDeclaration.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/DestructuringDeclaration.log.fe10.txt new file mode 100644 index 00000000000..f63f59d8c4f --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/DestructuringDeclaration.log.fe10.txt @@ -0,0 +1,49 @@ +UFile (package = ) + UClass (name = DestructuringDeclarationKt) + UMethod (name = foo) + UParameter (name = data) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = var268d4435) + UAnnotation (fqName = null) + UBinaryExpression (operator = ) + ULiteralExpression (value = "foo") + ULiteralExpression (value = 1) + ULocalVariable (name = a) + UAnnotation (fqName = null) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = var268d4435) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (component1)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + ULocalVariable (name = b) + UAnnotation (fqName = null) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = var268d4435) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (component2)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + UDeclarationsExpression + ULocalVariable (name = var46597b30) + UAnnotation (fqName = null) + UAnnotation (fqName = kotlin.Suppress) + UNamedExpression (name = names) + ULiteralExpression (value = "UNCHECKED_CAST") + UBinaryExpressionWithType + USimpleNameReferenceExpression (identifier = data) + UTypeReferenceExpression (name = kotlin.Pair) + ULocalVariable (name = k) + UAnnotation (fqName = null) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = var46597b30) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (component1)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + ULocalVariable (name = v) + UAnnotation (fqName = null) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = var46597b30) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (component2)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) diff --git a/plugins/uast-kotlin-fir/testData/legacy/DestructuringDeclaration.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/DestructuringDeclaration.render.fe10.txt new file mode 100644 index 00000000000..0d72cce475f --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/DestructuringDeclaration.render.fe10.txt @@ -0,0 +1,10 @@ +public final class DestructuringDeclarationKt { + public static final fun foo(@org.jetbrains.annotations.NotNull data: java.lang.Object) : void { + @null var var268d4435: = "foo" 1 + @null var a: java.lang.String = var268d4435.() + @null var b: int = var268d4435.() + @null @kotlin.Suppress(names = "UNCHECKED_CAST") var var46597b30: = data as kotlin.Pair + @null var k: java.lang.String = var46597b30.() + @null var v: java.lang.String = var46597b30.() + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/Elvis.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Elvis.log.fe10.txt new file mode 100644 index 00000000000..88409aa8899 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Elvis.log.fe10.txt @@ -0,0 +1,46 @@ +UFile (package = ) + UClass (name = ElvisKt) + UMethod (name = foo) + UParameter (name = bar) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + ULiteralExpression (value = null) + UMethod (name = bar) + UBlockExpression + UReturnExpression + ULiteralExpression (value = 42) + UMethod (name = baz) + UBlockExpression + UReturnExpression + UExpressionList (elvis) + UDeclarationsExpression + ULocalVariable (name = var243c5407) + UExpressionList (elvis) + UDeclarationsExpression + ULocalVariable (name = varc4aef7d0) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (foo)) + USimpleNameReferenceExpression (identifier = foo, resolvesTo = null) + ULiteralExpression (value = "Lorem ipsum") + UIfExpression + UBinaryExpression (operator = !=) + USimpleNameReferenceExpression (identifier = varc4aef7d0) + ULiteralExpression (value = null) + USimpleNameReferenceExpression (identifier = varc4aef7d0) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (foo)) + USimpleNameReferenceExpression (identifier = foo, resolvesTo = null) + ULiteralExpression (value = "dolor sit amet") + UIfExpression + UBinaryExpression (operator = !=) + USimpleNameReferenceExpression (identifier = var243c5407) + ULiteralExpression (value = null) + USimpleNameReferenceExpression (identifier = var243c5407) + UQualifiedReferenceExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (bar)) + USimpleNameReferenceExpression (identifier = bar, resolvesTo = null) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (toString)) + USimpleNameReferenceExpression (identifier = toString, resolvesTo = null) diff --git a/plugins/uast-kotlin-fir/testData/legacy/Elvis.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Elvis.render.fe10.txt new file mode 100644 index 00000000000..cd0357d5b08 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Elvis.render.fe10.txt @@ -0,0 +1,17 @@ +public final class ElvisKt { + public static final fun foo(@org.jetbrains.annotations.NotNull bar: java.lang.String) : java.lang.String { + return null + } + public static final fun bar() : int { + return 42 + } + public static final fun baz() : java.lang.String { + return elvis { + var var243c5407: java.lang.String = elvis { + var varc4aef7d0: java.lang.String = foo("Lorem ipsum") + if (varc4aef7d0 != null) varc4aef7d0 else foo("dolor sit amet") + } + if (var243c5407 != null) var243c5407 else bar().toString() + } + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/ElvisType.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ElvisType.log.fe10.txt new file mode 100644 index 00000000000..cf69821e104 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ElvisType.log.fe10.txt @@ -0,0 +1,24 @@ +UFile (package = ) + UClass (name = ElvisTypeKt) + UMethod (name = foo) + UParameter (name = text) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (bar)) + USimpleNameReferenceExpression (identifier = bar, resolvesTo = null) + UExpressionList (elvis) + UDeclarationsExpression + ULocalVariable (name = var63c49860) + USimpleNameReferenceExpression (identifier = text) + UIfExpression + UBinaryExpression (operator = !=) + USimpleNameReferenceExpression (identifier = var63c49860) + ULiteralExpression (value = null) + USimpleNameReferenceExpression (identifier = var63c49860) + UReturnExpression + UMethod (name = bar) + UParameter (name = o) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression diff --git a/plugins/uast-kotlin-fir/testData/legacy/ElvisType.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ElvisType.render.fe10.txt new file mode 100644 index 00000000000..983d718f4ce --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ElvisType.render.fe10.txt @@ -0,0 +1,10 @@ +public final class ElvisTypeKt { + public static final fun foo(@org.jetbrains.annotations.Nullable text: java.lang.String) : void { + return bar(elvis { + var var63c49860: java.lang.String = text + if (var63c49860 != null) var63c49860 else return + }) + } + public static final fun bar(@org.jetbrains.annotations.NotNull o: java.lang.Object) : void { + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/EnumValueMembers.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/EnumValueMembers.log.fe10.txt new file mode 100644 index 00000000000..bd07a46ab5d --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/EnumValueMembers.log.fe10.txt @@ -0,0 +1,19 @@ +UFile (package = ) + UClass (name = Style) + UField (name = value) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UEnumConstant (name = SHEET) + UAnnotation (fqName = null) + USimpleNameReferenceExpression (identifier = Style) + ULiteralExpression (value = "foo") + UClass (name = SHEET) + UMethod (name = getExitAnimation) + UBlockExpression + UReturnExpression + ULiteralExpression (value = "bar") + UMethod (name = SHEET) + UMethod (name = getExitAnimation) + UMethod (name = getValue) + UMethod (name = Style) + UParameter (name = value) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) diff --git a/plugins/uast-kotlin-fir/testData/legacy/EnumValueMembers.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/EnumValueMembers.render.fe10.txt new file mode 100644 index 00000000000..0b9be77a0f3 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/EnumValueMembers.render.fe10.txt @@ -0,0 +1,12 @@ +public enum Style { + @org.jetbrains.annotations.NotNull private final var value: java.lang.String + @null SHEET("foo") { + public fun getExitAnimation() : java.lang.String { + return "bar" + } + fun SHEET() = UastEmptyExpression + } + public abstract fun getExitAnimation() : java.lang.String = UastEmptyExpression + public final fun getValue() : java.lang.String = UastEmptyExpression + private fun Style(@org.jetbrains.annotations.NotNull value: java.lang.String) = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/EnumValuesConstructors.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/EnumValuesConstructors.log.fe10.txt new file mode 100644 index 00000000000..130f197f532 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/EnumValuesConstructors.log.fe10.txt @@ -0,0 +1,24 @@ +UFile (package = ) + UClass (name = Style) + UField (name = value) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UEnumConstant (name = SYSTEM) + UAnnotation (fqName = null) + USimpleNameReferenceExpression (identifier = Style) + ULiteralExpression (value = "system") + UEnumConstant (name = USER) + UAnnotation (fqName = null) + USimpleNameReferenceExpression (identifier = Style) + ULiteralExpression (value = "user") + UEnumConstant (name = INTERNAL) + UAnnotation (fqName = null) + USimpleNameReferenceExpression (identifier = Style) + ULiteralExpression (value = "internal") + UEnumConstant (name = UNKNOWN) + UAnnotation (fqName = null) + USimpleNameReferenceExpression (identifier = Style) + ULiteralExpression (value = null) + UMethod (name = getValue) + UMethod (name = Style) + UParameter (name = value) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) diff --git a/plugins/uast-kotlin-fir/testData/legacy/EnumValuesConstructors.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/EnumValuesConstructors.render.fe10.txt new file mode 100644 index 00000000000..04517caf5b1 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/EnumValuesConstructors.render.fe10.txt @@ -0,0 +1,9 @@ +public enum Style { + @org.jetbrains.annotations.Nullable private final var value: java.lang.String + @null SYSTEM("system") + @null USER("user") + @null INTERNAL("internal") + @null UNKNOWN(null) + public final fun getValue() : java.lang.String = UastEmptyExpression + private fun Style(@org.jetbrains.annotations.Nullable value: java.lang.String) = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/IfStatement.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/IfStatement.log.fe10.txt new file mode 100644 index 00000000000..fdce860179d --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/IfStatement.log.fe10.txt @@ -0,0 +1,12 @@ +UFile (package = ) + UClass (name = IfStatementKt) + UMethod (name = foo) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = x) + UIfExpression + UBinaryExpression (operator = !=) + ULiteralExpression (value = "abc") + ULiteralExpression (value = "def") + ULiteralExpression (value = 1) + ULiteralExpression (value = 0) diff --git a/plugins/uast-kotlin-fir/testData/legacy/IfStatement.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/IfStatement.render.fe10.txt new file mode 100644 index 00000000000..7088325bb4e --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/IfStatement.render.fe10.txt @@ -0,0 +1,5 @@ +public final class IfStatementKt { + public static final fun foo() : void { + var x: int = if ("abc" != "def") 1 else 0 + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/Imports.kt b/plugins/uast-kotlin-fir/testData/legacy/Imports.kt deleted file mode 100644 index 2a3a8414ad6..00000000000 --- a/plugins/uast-kotlin-fir/testData/legacy/Imports.kt +++ /dev/null @@ -1,6 +0,0 @@ -import java.lang.Thread.currentThread -import java.lang.Thread.NORM_PRIORITY -import java.lang.Thread.UncaughtExceptionHandler -import java.lang.Thread.sleep -import kotlin.collections.emptyList -import kotlin.Int.Companion.SIZE_BYTES diff --git a/plugins/uast-kotlin-fir/testData/legacy/In.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/In.log.fe10.txt new file mode 100644 index 00000000000..565db0b4903 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/In.log.fe10.txt @@ -0,0 +1,22 @@ +UFile (package = ) + UClass (name = InKt) + UMethod (name = foo) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = x) + ULiteralExpression (value = 1) + UDeclarationsExpression + ULocalVariable (name = y) + ULiteralExpression (value = 10) + UReturnExpression + UBinaryExpression (operator = &&) + UBinaryExpression (operator = in) + USimpleNameReferenceExpression (identifier = x) + UBinaryExpression (operator = ..) + ULiteralExpression (value = 0) + ULiteralExpression (value = 5) + UBinaryExpression (operator = !in) + USimpleNameReferenceExpression (identifier = y) + UBinaryExpression (operator = ..) + ULiteralExpression (value = 4) + ULiteralExpression (value = 9) diff --git a/plugins/uast-kotlin-fir/testData/legacy/In.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/In.render.fe10.txt new file mode 100644 index 00000000000..c8cc29743d2 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/In.render.fe10.txt @@ -0,0 +1,7 @@ +public final class InKt { + public static final fun foo() : boolean { + var x: int = 1 + var y: int = 10 + return x in 0 .. 5 && y !in 4 .. 9 + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/InferenceInsideUnresolvedConstructor.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/InferenceInsideUnresolvedConstructor.log.fe10.txt new file mode 100644 index 00000000000..367deb191c6 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/InferenceInsideUnresolvedConstructor.log.fe10.txt @@ -0,0 +1,18 @@ +UFile (package = ) + UClass (name = InferenceInsideUnresolvedConstructorKt) + UMethod (name = getBar) + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (Unresolved)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (id)) + USimpleNameReferenceExpression (identifier = id, resolvesTo = null) + ULiteralExpression (value = 42) + UMethod (name = id) + UParameter (name = x) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = x) diff --git a/plugins/uast-kotlin-fir/testData/legacy/InferenceInsideUnresolvedConstructor.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/InferenceInsideUnresolvedConstructor.render.fe10.txt new file mode 100644 index 00000000000..a41f7ec8c51 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/InferenceInsideUnresolvedConstructor.render.fe10.txt @@ -0,0 +1,8 @@ +public final class InferenceInsideUnresolvedConstructorKt { + public static final fun getBar() : java.lang.Object { + return (id(42)) + } + public static final fun id(@org.jetbrains.annotations.Nullable x: T) : T { + return x + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/InnerClasses.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/InnerClasses.log.fe10.txt new file mode 100644 index 00000000000..af986760bbf --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/InnerClasses.log.fe10.txt @@ -0,0 +1,27 @@ +UFile (package = ) + UClass (name = Foo) + UMethod (name = Foo) + UClass (name = Bar) + UField (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UField (name = b) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UMethod (name = getAPlusB) + UBlockExpression + UReturnExpression + UBinaryExpression (operator = +) + USimpleNameReferenceExpression (identifier = a) + USimpleNameReferenceExpression (identifier = b) + UMethod (name = getA) + UMethod (name = getB) + UMethod (name = Bar) + UParameter (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = b) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UClass (name = Baz) + UMethod (name = doNothing) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = Unit) + UMethod (name = Baz) diff --git a/plugins/uast-kotlin-fir/testData/legacy/InnerClasses.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/InnerClasses.render.fe10.txt new file mode 100644 index 00000000000..863933febda --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/InnerClasses.render.fe10.txt @@ -0,0 +1,19 @@ +public final class Foo { + public fun Foo() = UastEmptyExpression + public static final class Bar { + @org.jetbrains.annotations.NotNull private final var a: int + @org.jetbrains.annotations.NotNull private final var b: int + public final fun getAPlusB() : int { + return a + b + } + public final fun getA() : int = UastEmptyExpression + public final fun getB() : int = UastEmptyExpression + public fun Bar(@org.jetbrains.annotations.NotNull a: int, @org.jetbrains.annotations.NotNull b: int) = UastEmptyExpression + public static final class Baz { + public final fun doNothing() : void { + return Unit + } + public fun Baz() = UastEmptyExpression + } + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/InnerNonFixedTypeVariable.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/InnerNonFixedTypeVariable.log.fe10.txt new file mode 100644 index 00000000000..dc57783fd18 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/InnerNonFixedTypeVariable.log.fe10.txt @@ -0,0 +1,22 @@ +UFile (package = ) + UClass (name = InnerNonFixedTypeVariableKt) + UMethod (name = test) + UParameter (name = list) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UQualifiedReferenceExpression + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = list) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (filterIsInstance)) + USimpleNameReferenceExpression (identifier = filterIsInstance, resolvesTo = null) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) + UIdentifier (Identifier (mapTo)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (mutableSetOf)) + USimpleNameReferenceExpression (identifier = mutableSetOf, resolvesTo = null) + ULambdaExpression + UBlockExpression + UClass (name = Some) + UMethod (name = Some) diff --git a/plugins/uast-kotlin-fir/testData/legacy/InnerNonFixedTypeVariable.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/InnerNonFixedTypeVariable.render.fe10.txt new file mode 100644 index 00000000000..b0011a83b85 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/InnerNonFixedTypeVariable.render.fe10.txt @@ -0,0 +1,11 @@ +public final class InnerNonFixedTypeVariableKt { + public static final fun test(@org.jetbrains.annotations.NotNull list: java.util.List) : void { + list.filterIsInstance().(mutableSetOf(), { + + }) + } +} + +public final class Some { + public fun Some() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/LambdaReturn.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/LambdaReturn.log.fe10.txt new file mode 100644 index 00000000000..c7186e63828 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/LambdaReturn.log.fe10.txt @@ -0,0 +1,141 @@ +UFile (package = org.jetbrains.uast.kotlin) + UClass (name = LambdaReturnKt) + UMethod (name = foo) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = lam1) + ULambdaExpression + UParameter (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = b) + ULiteralExpression (value = 1) + UReturnExpression + UBinaryExpression (operator = +) + USimpleNameReferenceExpression (identifier = a) + USimpleNameReferenceExpression (identifier = b) + UDeclarationsExpression + ULocalVariable (name = lam2) + ULambdaExpression + UParameter (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = c) + ULiteralExpression (value = 1) + UReturnExpression + UIfExpression + UBinaryExpression (operator = >) + USimpleNameReferenceExpression (identifier = a) + ULiteralExpression (value = 0) + UBinaryExpression (operator = +) + USimpleNameReferenceExpression (identifier = a) + USimpleNameReferenceExpression (identifier = c) + UBinaryExpression (operator = -) + USimpleNameReferenceExpression (identifier = a) + USimpleNameReferenceExpression (identifier = c) + UDeclarationsExpression + ULocalVariable (name = lam3) + ULabeledExpression (label = lbd) + ULambdaExpression + UParameter (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = d) + ULiteralExpression (value = 1) + UReturnExpression + UBinaryExpression (operator = +) + USimpleNameReferenceExpression (identifier = a) + USimpleNameReferenceExpression (identifier = d) + UDeclarationsExpression + ULocalVariable (name = lam4) + ULambdaExpression + UParameter (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UIfExpression + UBinaryExpression (operator = <) + USimpleNameReferenceExpression (identifier = a) + ULiteralExpression (value = 5) + UReturnExpression + ULiteralExpression (value = "5") + UIfExpression + UBinaryExpression (operator = >) + USimpleNameReferenceExpression (identifier = a) + ULiteralExpression (value = 0) + UReturnExpression + ULiteralExpression (value = "1") + UReturnExpression + ULiteralExpression (value = "2") + UDeclarationsExpression + ULocalVariable (name = lam5) + ULambdaExpression + UParameter (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + UBinaryExpression (operator = +) + ULiteralExpression (value = "a") + USimpleNameReferenceExpression (identifier = a) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (bar)) + USimpleNameReferenceExpression (identifier = bar, resolvesTo = null) + ULambdaExpression + UParameter (name = it) + UBlockExpression + UIfExpression + UBinaryExpression (operator = >) + USimpleNameReferenceExpression (identifier = it) + ULiteralExpression (value = 5) + UReturnExpression + UDeclarationsExpression + ULocalVariable (name = b) + ULiteralExpression (value = 1) + UReturnExpression + UBinaryExpression (operator = +) + USimpleNameReferenceExpression (identifier = it) + USimpleNameReferenceExpression (identifier = b) + UDeclarationsExpression + ULocalVariable (name = x) + ULambdaExpression + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = vardbcd09b4) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) + UIdentifier (Identifier (listOf)) + USimpleNameReferenceExpression (identifier = listOf, resolvesTo = null) + ULiteralExpression (value = 1) + ULiteralExpression (value = 2) + ULocalVariable (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = vardbcd09b4) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (component1)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + ULocalVariable (name = b) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = vardbcd09b4) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (component2)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + UDeclarationsExpression + ULocalVariable (name = y) + ULambdaExpression + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (listOf)) + USimpleNameReferenceExpression (identifier = listOf, resolvesTo = null) + ULiteralExpression (value = 1) + UMethod (name = bar) + UParameter (name = lmbd) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (lmbd)) + USimpleNameReferenceExpression (identifier = invoke, resolvesTo = null) + ULiteralExpression (value = 1) diff --git a/plugins/uast-kotlin-fir/testData/legacy/LambdaReturn.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/LambdaReturn.render.fe10.txt new file mode 100644 index 00000000000..fdaf0dd3313 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/LambdaReturn.render.fe10.txt @@ -0,0 +1,45 @@ +package org.jetbrains.uast.kotlin + +public final class LambdaReturnKt { + public static final fun foo() : void { + var lam1: kotlin.jvm.functions.Function1 = { @org.jetbrains.annotations.NotNull var a: int -> + + var b: int = 1 + return a + b + } + var lam2: kotlin.jvm.functions.Function1 = { @org.jetbrains.annotations.NotNull var a: int -> + + var c: int = 1 + return if (a > 0) a + c else a - c + } + var lam3: kotlin.jvm.functions.Function1 = lbd@ { @org.jetbrains.annotations.NotNull var a: int -> + + var d: int = 1 + return a + d + } + var lam4: kotlin.jvm.functions.Function1 = fun (@org.jetbrains.annotations.NotNull var a: int) { + if (a < 5) return "5" + if (a > 0) return "1" else return "2" + } + var lam5: kotlin.jvm.functions.Function1 = fun (@org.jetbrains.annotations.NotNull var a: int) { + return "a" + a + } + bar({ var it: int -> + + if (it > 5) return + var b: int = 1 + return it + b + }) + var x: kotlin.jvm.functions.Function0 = { + @org.jetbrains.annotations.NotNull var vardbcd09b4: = listOf(1, 2) + @org.jetbrains.annotations.NotNull var a: int = vardbcd09b4.() + @org.jetbrains.annotations.NotNull var b: int = vardbcd09b4.() + } + var y: kotlin.jvm.functions.Function0 = { + listOf(1) + } + } + private static final fun bar(@org.jetbrains.annotations.NotNull lmbd: kotlin.jvm.functions.Function1) : void { + invoke(1) + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/Lambdas.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Lambdas.log.fe10.txt new file mode 100644 index 00000000000..aec871539f3 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Lambdas.log.fe10.txt @@ -0,0 +1,47 @@ +UFile (package = ) + UImportStatement (isOnDemand = false) + UClass (name = LambdasKt) + UMethod (name = foo) + UBlockExpression + UQualifiedReferenceExpression + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = Stream) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (empty)) + USimpleNameReferenceExpression (identifier = empty, resolvesTo = null) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (filter)) + USimpleNameReferenceExpression (identifier = filter, resolvesTo = null) + ULambdaExpression + UParameter (name = it) + UBlockExpression + UReturnExpression + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = it) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (isEmpty)) + USimpleNameReferenceExpression (identifier = isEmpty, resolvesTo = null) + UMethod (name = doSelectItem) + UParameter (name = selectItemFunction) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (selectItemFunction)) + USimpleNameReferenceExpression (identifier = invoke, resolvesTo = null) + UDeclarationsExpression + ULocalVariable (name = baz) + ULambdaExpression + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (Local)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (baz)) + USimpleNameReferenceExpression (identifier = invoke, resolvesTo = null) + UMethod (name = lambdaInPlaceCall) + UBlockExpression + UWhileExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier ({)) + USimpleNameReferenceExpression (identifier = invoke, resolvesTo = null) + UBlockExpression diff --git a/plugins/uast-kotlin-fir/testData/legacy/Lambdas.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Lambdas.render.fe10.txt new file mode 100644 index 00000000000..1f4107388cf --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Lambdas.render.fe10.txt @@ -0,0 +1,21 @@ +import java.util.stream.Stream + +public final class LambdasKt { + public static final fun foo() : void { + Stream.empty().filter({ var it: java.lang.String -> + + return it.isEmpty() + }) + } + public static final fun doSelectItem(@org.jetbrains.annotations.NotNull selectItemFunction: kotlin.jvm.functions.Function0) : void { + invoke() + var baz: kotlin.jvm.functions.Function0 = fun () { + () + } + invoke() + } + public static final fun lambdaInPlaceCall() : void { + while (invoke()) { + } + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/LocalDeclarations.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/LocalDeclarations.log.fe10.txt new file mode 100644 index 00000000000..872c844b6d7 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/LocalDeclarations.log.fe10.txt @@ -0,0 +1,38 @@ +UFile (package = ) + UClass (name = LocalDeclarationsKt) + UMethod (name = foo) + UBlockExpression + UDeclarationsExpression + UClass (name = Local) + UMethod (name = Local) + UDeclarationsExpression + UVariable (name = bar) + ULambdaExpression + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) + UIdentifier (Identifier (Local)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: Local) + UDeclarationsExpression + ULocalVariable (name = baz) + ULambdaExpression + UBlockExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) + UIdentifier (Identifier (Local)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: Local) + UDeclarationsExpression + UVariable (name = someLocalFun) + ULambdaExpression + UParameter (name = text) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + ULiteralExpression (value = 42) + UReturnExpression + UBinaryExpression (operator = ==) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (bar)) + USimpleNameReferenceExpression (identifier = bar, resolvesTo = null) + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) + UIdentifier (Identifier (Local)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: Local) diff --git a/plugins/uast-kotlin-fir/testData/legacy/LocalDeclarations.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/LocalDeclarations.render.fe10.txt new file mode 100644 index 00000000000..d3d9c9d6c92 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/LocalDeclarations.render.fe10.txt @@ -0,0 +1,17 @@ +public final class LocalDeclarationsKt { + public static final fun foo() : boolean { + public static final class Local { + public fun Local() = UastEmptyExpression + } + var bar: = fun () { + return () + } + var baz: kotlin.jvm.functions.Function0 = fun () { + () + } + var someLocalFun: kotlin.jvm.functions.Function2 = fun (@org.jetbrains.annotations.NotNull var text: java.lang.String) { + return 42 + } + return bar() == () + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/LocalVariableWithAnnotation.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/LocalVariableWithAnnotation.log.fe10.txt new file mode 100644 index 00000000000..0576c834e75 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/LocalVariableWithAnnotation.log.fe10.txt @@ -0,0 +1,9 @@ +UFile (package = ) + UClass (name = LocalVariableWithAnnotationKt) + UMethod (name = foo) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = bar) + UAnnotation (fqName = TestAnnotation) + ULiteralExpression (value = "lorem ipsum") + UClass (name = TestAnnotation) diff --git a/plugins/uast-kotlin-fir/testData/legacy/LocalVariableWithAnnotation.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/LocalVariableWithAnnotation.render.fe10.txt new file mode 100644 index 00000000000..40973f0b6dc --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/LocalVariableWithAnnotation.render.fe10.txt @@ -0,0 +1,8 @@ +public final class LocalVariableWithAnnotationKt { + public static final fun foo() : void { + @TestAnnotation var bar: java.lang.String = "lorem ipsum" + } +} + +public abstract annotation TestAnnotation { +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/ManyAlternatives.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ManyAlternatives.log.fe10.txt new file mode 100644 index 00000000000..6ff7aa719fe --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ManyAlternatives.log.fe10.txt @@ -0,0 +1,17 @@ +UFile (package = ) + UClass (name = ClassA) + UField (name = paramAndProp) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UField (name = writebleProp) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = 0) + UMethod (name = getWritebleProp) + UMethod (name = setWritebleProp) + UParameter (name = writebleProp) + UAnnotation (fqName = null) + UMethod (name = getParamAndProp) + UMethod (name = ClassA) + UParameter (name = justParam) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = paramAndProp) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) diff --git a/plugins/uast-kotlin-fir/testData/legacy/ManyAlternatives.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ManyAlternatives.render.fe10.txt new file mode 100644 index 00000000000..fac36aecf41 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ManyAlternatives.render.fe10.txt @@ -0,0 +1,8 @@ +public final class ClassA { + @org.jetbrains.annotations.NotNull private final var paramAndProp: java.lang.String + @org.jetbrains.annotations.NotNull private var writebleProp: int = 0 + public final fun getWritebleProp() : int = UastEmptyExpression + public final fun setWritebleProp(@null writebleProp: int) : void = UastEmptyExpression + public final fun getParamAndProp() : java.lang.String = UastEmptyExpression + public fun ClassA(@org.jetbrains.annotations.NotNull justParam: int, @org.jetbrains.annotations.NotNull paramAndProp: java.lang.String) = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/MethodReference.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/MethodReference.log.fe10.txt new file mode 100644 index 00000000000..f214583a631 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/MethodReference.log.fe10.txt @@ -0,0 +1,10 @@ +UFile (package = ) + UClass (name = MethodReferenceKt) + UField (name = x) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UCallableReferenceExpression (name = bar) + UMethod (name = getX) + UClass (name = Foo) + UMethod (name = bar) + UBlockExpression + UMethod (name = Foo) diff --git a/plugins/uast-kotlin-fir/testData/legacy/MethodReference.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/MethodReference.render.fe10.txt new file mode 100644 index 00000000000..48143bccc74 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/MethodReference.render.fe10.txt @@ -0,0 +1,10 @@ +public final class MethodReferenceKt { + @org.jetbrains.annotations.NotNull private static final var x: kotlin.reflect.KFunction = Foo::bar + public static final fun getX() : kotlin.reflect.KFunction = UastEmptyExpression +} + +public final class Foo { + public final fun bar() : void { + } + public fun Foo() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/NameContainingFile.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/NameContainingFile.log.fe10.txt new file mode 100644 index 00000000000..ac94fc83e77 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/NameContainingFile.log.fe10.txt @@ -0,0 +1,10 @@ +UFile (package = ) + UClass (name = NameContainingFileKt) + UField (name = xyzzy) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = 0) + UMethod (name = bar) + UBlockExpression + UMethod (name = getXyzzy) + UClass (name = Foo) + UMethod (name = Foo) diff --git a/plugins/uast-kotlin-fir/testData/legacy/NameContainingFile.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/NameContainingFile.render.fe10.txt new file mode 100644 index 00000000000..379d4e3aba2 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/NameContainingFile.render.fe10.txt @@ -0,0 +1,10 @@ +public final class NameContainingFileKt { + @org.jetbrains.annotations.NotNull private static final var xyzzy: int = 0 + public static final fun bar() : void { + } + public static final fun getXyzzy() : int = UastEmptyExpression +} + +public final class Foo { + public fun Foo() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/NonTrivialIdentifiers.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/NonTrivialIdentifiers.log.fe10.txt new file mode 100644 index 00000000000..97180a87045 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/NonTrivialIdentifiers.log.fe10.txt @@ -0,0 +1,38 @@ +UFile (package = ) + UClass (name = NonTrivialIdentifiersKt) + UMethod (name = main) + UParameter (name = a) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (()) + USimpleNameReferenceExpression (identifier = invoke, resolvesTo = null) + UDeclarationsExpression + ULocalVariable (name = p) + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) + UIdentifier (Identifier (A)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: A) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier ({)) + USimpleNameReferenceExpression (identifier = invoke, resolvesTo = null) + ULambdaExpression + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (p)) + USimpleNameReferenceExpression (identifier = invoke, resolvesTo = null) + ULambdaExpression + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (()) + USimpleNameReferenceExpression (identifier = invoke, resolvesTo = null) + UClass (name = A) + UMethod (name = invoke) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (()) + USimpleNameReferenceExpression (identifier = invoke, resolvesTo = null) + UMethod (name = invoke) + UParameter (name = f) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UMethod (name = A) diff --git a/plugins/uast-kotlin-fir/testData/legacy/NonTrivialIdentifiers.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/NonTrivialIdentifiers.render.fe10.txt new file mode 100644 index 00000000000..c5f2f10b66b --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/NonTrivialIdentifiers.render.fe10.txt @@ -0,0 +1,20 @@ +public final class NonTrivialIdentifiersKt { + public static final fun main(@org.jetbrains.annotations.Nullable a: A) : void { + invoke() + var p: A = () + invoke({ + invoke({ + invoke() + }) + }) + } +} + +public final class A { + public final fun invoke() : void { + invoke() + } + public final fun invoke(@org.jetbrains.annotations.NotNull f: kotlin.jvm.functions.Function0) : void { + } + public fun A() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/ParameterPropertyWithAnnotation.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ParameterPropertyWithAnnotation.log.fe10.txt new file mode 100644 index 00000000000..0eada479127 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ParameterPropertyWithAnnotation.log.fe10.txt @@ -0,0 +1,31 @@ +UFile (package = ) + UClass (name = MyAnnotation) + UClass (name = MyAnnotation2) + UClass (name = MyAnnotation3) + UClass (name = MyAnnotation4) + UClass (name = MyAnnotation5) + UClass (name = Test1) + UField (name = bar) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UMethod (name = getBar) + UMethod (name = setBar) + UParameter (name = bar) + UAnnotation (fqName = null) + UMethod (name = Test1) + UParameter (name = bar) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UAnnotation (fqName = MyAnnotation) + UClass (name = Test2) + UField (name = bar) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UAnnotation (fqName = MyAnnotation5) + UMethod (name = getBar) + UAnnotation (fqName = MyAnnotation) + UMethod (name = setBar) + UAnnotation (fqName = MyAnnotation2) + UParameter (name = bar) + UAnnotation (fqName = MyAnnotation3) + UAnnotation (fqName = null) + UMethod (name = Test2) + UParameter (name = bar) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) diff --git a/plugins/uast-kotlin-fir/testData/legacy/ParameterPropertyWithAnnotation.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ParameterPropertyWithAnnotation.render.fe10.txt new file mode 100644 index 00000000000..b87a33358c6 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ParameterPropertyWithAnnotation.render.fe10.txt @@ -0,0 +1,30 @@ +public abstract annotation MyAnnotation { +} + +public abstract annotation MyAnnotation2 { +} + +public abstract annotation MyAnnotation3 { +} + +public abstract annotation MyAnnotation4 { +} + +public abstract annotation MyAnnotation5 { +} + +public final class Test1 { + @org.jetbrains.annotations.NotNull private var bar: int + public final fun getBar() : int = UastEmptyExpression + public final fun setBar(@null bar: int) : void = UastEmptyExpression + public fun Test1(@org.jetbrains.annotations.NotNull @MyAnnotation bar: int) = UastEmptyExpression +} + +public final class Test2 { + @org.jetbrains.annotations.NotNull @MyAnnotation5 private var bar: int + @MyAnnotation + public final fun getBar() : int = UastEmptyExpression + @MyAnnotation2 + public final fun setBar(@MyAnnotation3 @null bar: int) : void = UastEmptyExpression + public fun Test2(@org.jetbrains.annotations.NotNull bar: int) = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/ParametersDisorder.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ParametersDisorder.log.fe10.txt new file mode 100644 index 00000000000..6e1661d9791 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ParametersDisorder.log.fe10.txt @@ -0,0 +1,163 @@ +UFile (package = ) + UClass (name = ParametersDisorderKt) + UMethod (name = global) + UParameter (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = b) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UMethod (name = withDefault) + UParameter (name = c) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = 1) + UParameter (name = d) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = "aaa") + UBlockExpression + UMethod (name = withReceiver) + UParameter (name = $this$withReceiver) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = b) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UMethod (name = call) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) + UIdentifier (Identifier (global)) + USimpleNameReferenceExpression (identifier = global, resolvesTo = null) + ULiteralExpression (value = 2.2) + ULiteralExpression (value = 2) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (withDefault)) + USimpleNameReferenceExpression (identifier = withDefault, resolvesTo = null) + ULiteralExpression (value = "bbb") + UQualifiedReferenceExpression + ULiteralExpression (value = "abc") + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) + UIdentifier (Identifier (withReceiver)) + USimpleNameReferenceExpression (identifier = withReceiver, resolvesTo = null) + ULiteralExpression (value = 1) + ULiteralExpression (value = 1.2) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = Math) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) + UIdentifier (Identifier (atan2)) + USimpleNameReferenceExpression (identifier = atan2, resolvesTo = null) + ULiteralExpression (value = 1.3) + ULiteralExpression (value = 3.4) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) + UIdentifier (Identifier (unresolvedMethod)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + ULiteralExpression (value = "param1") + ULiteralExpression (value = "param2") + UQualifiedReferenceExpression + UQualifiedReferenceExpression + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = java) + USimpleNameReferenceExpression (identifier = lang) + USimpleNameReferenceExpression (identifier = String) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 4)) + UIdentifier (Identifier (format)) + USimpleNameReferenceExpression (identifier = format, resolvesTo = null) + ULiteralExpression (value = "%i %i %i") + ULiteralExpression (value = 1) + ULiteralExpression (value = 2) + ULiteralExpression (value = 3) + UQualifiedReferenceExpression + UQualifiedReferenceExpression + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = java) + USimpleNameReferenceExpression (identifier = lang) + USimpleNameReferenceExpression (identifier = String) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) + UIdentifier (Identifier (format)) + USimpleNameReferenceExpression (identifier = format, resolvesTo = null) + ULiteralExpression (value = "%i %i %i") + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 3)) + UIdentifier (Identifier (arrayOf)) + USimpleNameReferenceExpression (identifier = arrayOf, resolvesTo = null) + ULiteralExpression (value = 1) + ULiteralExpression (value = 2) + ULiteralExpression (value = 3) + UQualifiedReferenceExpression + UQualifiedReferenceExpression + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = java) + USimpleNameReferenceExpression (identifier = lang) + USimpleNameReferenceExpression (identifier = String) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 3)) + UIdentifier (Identifier (format)) + USimpleNameReferenceExpression (identifier = format, resolvesTo = null) + ULiteralExpression (value = "%i %i %i") + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 3)) + UIdentifier (Identifier (arrayOf)) + USimpleNameReferenceExpression (identifier = arrayOf, resolvesTo = null) + ULiteralExpression (value = 1) + ULiteralExpression (value = 2) + ULiteralExpression (value = 3) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 3)) + UIdentifier (Identifier (arrayOf)) + USimpleNameReferenceExpression (identifier = arrayOf, resolvesTo = null) + ULiteralExpression (value = 4) + ULiteralExpression (value = 5) + ULiteralExpression (value = 6) + UQualifiedReferenceExpression + UQualifiedReferenceExpression + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = java) + USimpleNameReferenceExpression (identifier = lang) + USimpleNameReferenceExpression (identifier = String) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) + UIdentifier (Identifier (format)) + USimpleNameReferenceExpression (identifier = format, resolvesTo = null) + ULiteralExpression (value = "%i %i %i") + UQualifiedReferenceExpression + UQualifiedReferenceExpression + ULiteralExpression (value = "") + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (chunked)) + USimpleNameReferenceExpression (identifier = chunked, resolvesTo = null) + ULiteralExpression (value = 2) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (toTypedArray)) + USimpleNameReferenceExpression (identifier = toTypedArray, resolvesTo = null) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) + UIdentifier (Identifier (with)) + USimpleNameReferenceExpression (identifier = with, resolvesTo = null) + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) + UIdentifier (Identifier (A)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: A) + ULambdaExpression + UBlockExpression + UQualifiedReferenceExpression + ULiteralExpression (value = "def") + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) + UIdentifier (Identifier (with2Receivers)) + USimpleNameReferenceExpression (identifier = with2Receivers, resolvesTo = null) + ULiteralExpression (value = 8) + ULiteralExpression (value = 7.0) + UMethod (name = objectLiteral) + UBlockExpression + UObjectLiteralExpression + ULiteralExpression (value = 1) + ULiteralExpression (value = "foo") + UClass (name = null) + UMethod (name = ) + UClass (name = A) + UMethod (name = with2Receivers) + UParameter (name = $this$with2Receivers) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = b) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UMethod (name = A) + UClass (name = Parent) + UMethod (name = Parent) + UParameter (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = b) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) diff --git a/plugins/uast-kotlin-fir/testData/legacy/ParametersDisorder.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ParametersDisorder.render.fe10.txt new file mode 100644 index 00000000000..dde115c8dec --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ParametersDisorder.render.fe10.txt @@ -0,0 +1,35 @@ +public final class ParametersDisorderKt { + public static final fun global(@org.jetbrains.annotations.NotNull a: int, @org.jetbrains.annotations.NotNull b: float) : void { + } + public static final fun withDefault(@org.jetbrains.annotations.NotNull c: int, @org.jetbrains.annotations.NotNull d: java.lang.String) : void { + } + public static final fun withReceiver(@org.jetbrains.annotations.NotNull $this$withReceiver: java.lang.String, @org.jetbrains.annotations.NotNull a: int, @org.jetbrains.annotations.NotNull b: float) : void { + } + public static final fun call() : void { + global(2.2, 2) + withDefault("bbb") + "abc".withReceiver(1, 1.2) + Math.atan2(1.3, 3.4) + ("param1", "param2") + java.lang.String.format("%i %i %i", 1, 2, 3) + java.lang.String.format("%i %i %i", arrayOf(1, 2, 3)) + java.lang.String.format("%i %i %i", arrayOf(1, 2, 3), arrayOf(4, 5, 6)) + java.lang.String.format("%i %i %i", "".chunked(2).toTypedArray()) + with((), { + "def".with2Receivers(8, 7.0) + }) + } + public static final fun objectLiteral() : void { + anonymous object : Parent(b = 1, a = "foo") { } + } +} + +public final class A { + public final fun with2Receivers(@org.jetbrains.annotations.NotNull $this$with2Receivers: java.lang.String, @org.jetbrains.annotations.NotNull a: int, @org.jetbrains.annotations.NotNull b: float) : void { + } + public fun A() = UastEmptyExpression +} + +public class Parent { + public fun Parent(@org.jetbrains.annotations.NotNull a: java.lang.String, @org.jetbrains.annotations.NotNull b: int) = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/ParametersWithDefaultValues.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ParametersWithDefaultValues.log.fe10.txt new file mode 100644 index 00000000000..fce73abf596 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ParametersWithDefaultValues.log.fe10.txt @@ -0,0 +1,14 @@ +UFile (package = ) + UClass (name = ParametersWithDefaultValuesKt) + UMethod (name = foo) + UParameter (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = b) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = c) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = 0) + UParameter (name = flag) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = false) + UBlockExpression diff --git a/plugins/uast-kotlin-fir/testData/legacy/ParametersWithDefaultValues.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ParametersWithDefaultValues.render.fe10.txt new file mode 100644 index 00000000000..c47f8f69528 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ParametersWithDefaultValues.render.fe10.txt @@ -0,0 +1,4 @@ +public final class ParametersWithDefaultValuesKt { + public static final fun foo(@org.jetbrains.annotations.NotNull a: int, @org.jetbrains.annotations.NotNull b: java.lang.String, @org.jetbrains.annotations.NotNull c: int, @org.jetbrains.annotations.NotNull flag: boolean) : void { + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/PropertyAccessors.kt b/plugins/uast-kotlin-fir/testData/legacy/PropertyAccessors.kt deleted file mode 100644 index 7aaae03799f..00000000000 --- a/plugins/uast-kotlin-fir/testData/legacy/PropertyAccessors.kt +++ /dev/null @@ -1,11 +0,0 @@ -class PropertyTest { - var stringRepresentation: String - get() = this.toString() - set(value) { - setDataFromString(value) - } - - fun setDataFromString(data: String) { - - } -} diff --git a/plugins/uast-kotlin-fir/testData/legacy/PropertyDelegate.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/PropertyDelegate.log.fe10.txt new file mode 100644 index 00000000000..42d7e5aa6fe --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/PropertyDelegate.log.fe10.txt @@ -0,0 +1,36 @@ +UFile (package = ) + UClass (name = PropertyDelegateKt) + UField (name = sdCardPath$delegate) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (lazy)) + USimpleNameReferenceExpression (identifier = lazy, resolvesTo = null) + ULambdaExpression + UBlockExpression + UReturnExpression + ULiteralExpression (value = "/sdcard") + UField (name = annotatedDelegate$delegate) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UAnnotation (fqName = kotlin.Suppress) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (lazy)) + USimpleNameReferenceExpression (identifier = lazy, resolvesTo = null) + ULambdaExpression + UBlockExpression + UReturnExpression + UBinaryExpression (operator = +) + ULiteralExpression (value = 1) + ULiteralExpression (value = 1) + UMethod (name = getSdCardPath) + UMethod (name = localPropertyTest) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = sdCardPathLocal) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (lazy)) + USimpleNameReferenceExpression (identifier = lazy, resolvesTo = null) + ULambdaExpression + UBlockExpression + UReturnExpression + ULiteralExpression (value = "/sdcard") + UMethod (name = getAnnotatedDelegate) diff --git a/plugins/uast-kotlin-fir/testData/legacy/PropertyDelegate.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/PropertyDelegate.render.fe10.txt new file mode 100644 index 00000000000..0f4ec9edd55 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/PropertyDelegate.render.fe10.txt @@ -0,0 +1,9 @@ +public final class PropertyDelegateKt { + @org.jetbrains.annotations.NotNull private static final var sdCardPath$delegate: kotlin.Lazy + @org.jetbrains.annotations.NotNull @kotlin.Suppress private static final var annotatedDelegate$delegate: kotlin.Lazy + public static final fun getSdCardPath() : java.lang.String = UastEmptyExpression + public static final fun localPropertyTest() : void { + var sdCardPathLocal: java.lang.String + } + public static final fun getAnnotatedDelegate() : int = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/PropertyInitializer.kt b/plugins/uast-kotlin-fir/testData/legacy/PropertyInitializer.kt deleted file mode 100644 index 96e21a830b9..00000000000 --- a/plugins/uast-kotlin-fir/testData/legacy/PropertyInitializer.kt +++ /dev/null @@ -1,7 +0,0 @@ -class TestPropertyInitializer { - var withSetter = "/sdcard" - get() = field - set(p) { - field = p - } -} diff --git a/plugins/uast-kotlin-fir/testData/legacy/PropertyInitializerWithoutSetter.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/PropertyInitializerWithoutSetter.log.fe10.txt new file mode 100644 index 00000000000..c2d823ff0e4 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/PropertyInitializerWithoutSetter.log.fe10.txt @@ -0,0 +1,12 @@ +UFile (package = ) + UClass (name = PropertyInitializerWithoutSetterKt) + UField (name = withoutSetter) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = "/sdcard") + UMethod (name = getWithoutSetter) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = field) + UMethod (name = setWithoutSetter) + UParameter (name = withoutSetter) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) diff --git a/plugins/uast-kotlin-fir/testData/legacy/PropertyInitializerWithoutSetter.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/PropertyInitializerWithoutSetter.render.fe10.txt new file mode 100644 index 00000000000..5cf1fa4a062 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/PropertyInitializerWithoutSetter.render.fe10.txt @@ -0,0 +1,7 @@ +public final class PropertyInitializerWithoutSetterKt { + @org.jetbrains.annotations.NotNull private static var withoutSetter: java.lang.String = "/sdcard" + public static final fun getWithoutSetter() : java.lang.String { + return field + } + public static final fun setWithoutSetter(@org.jetbrains.annotations.NotNull withoutSetter: java.lang.String) : void = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/PropertyReferences.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/PropertyReferences.log.fe10.txt new file mode 100644 index 00000000000..c91f0e043b0 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/PropertyReferences.log.fe10.txt @@ -0,0 +1,82 @@ +UFile (package = ) + UClass (name = PropertyReferencesKt) + UMethod (name = properties) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = a) + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) + UIdentifier (Identifier (A)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: A) + ULiteralExpression (value = 17) + UDeclarationsExpression + ULocalVariable (name = x) + UPrefixExpression (operator = -) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = a) + USimpleNameReferenceExpression (identifier = mutableProp) + UBinaryExpression (operator = =) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = a) + USimpleNameReferenceExpression (identifier = mutableProp) + ULiteralExpression (value = 1) + UBinaryExpression (operator = +=) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = a) + USimpleNameReferenceExpression (identifier = mutableProp) + USimpleNameReferenceExpression (identifier = x) + UPrefixExpression (operator = ++) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = a) + USimpleNameReferenceExpression (identifier = mutableProp) + UPostfixExpression (operator = --) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = a) + USimpleNameReferenceExpression (identifier = mutableProp) + UMethod (name = ext) + UParameter (name = $this$ext) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = x) + UPrefixExpression (operator = -) + USimpleNameReferenceExpression (identifier = mutableProp) + UBinaryExpression (operator = =) + USimpleNameReferenceExpression (identifier = mutableProp) + ULiteralExpression (value = 1) + UBinaryExpression (operator = +=) + USimpleNameReferenceExpression (identifier = mutableProp) + USimpleNameReferenceExpression (identifier = x) + UPrefixExpression (operator = ++) + USimpleNameReferenceExpression (identifier = mutableProp) + UPostfixExpression (operator = --) + USimpleNameReferenceExpression (identifier = mutableProp) + UClass (name = A) + UField (name = privateProp) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = 0) + UField (name = mutableProp) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UMethod (name = getMutableProp) + UMethod (name = setMutableProp) + UParameter (name = mutableProp) + UAnnotation (fqName = null) + UMethod (name = add) + UParameter (name = x) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = result) + USimpleNameReferenceExpression (identifier = privateProp) + UBinaryExpression (operator = =) + USimpleNameReferenceExpression (identifier = privateProp) + USimpleNameReferenceExpression (identifier = x) + UReturnExpression + USimpleNameReferenceExpression (identifier = privateProp) + UMethod (name = A) + UParameter (name = init) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UBlockExpression + UBinaryExpression (operator = =) + USimpleNameReferenceExpression (identifier = mutableProp) + USimpleNameReferenceExpression (identifier = init) diff --git a/plugins/uast-kotlin-fir/testData/legacy/PropertyReferences.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/PropertyReferences.render.fe10.txt new file mode 100644 index 00000000000..a710d8c482c --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/PropertyReferences.render.fe10.txt @@ -0,0 +1,34 @@ +public final class PropertyReferencesKt { + public static final fun properties() : void { + var a: A = (17) + var x: int = -a.mutableProp + a.mutableProp = 1 + a.mutableProp += x + ++a.mutableProp + a.mutableProp-- + } + public static final fun ext(@org.jetbrains.annotations.NotNull $this$ext: A) : void { + var x: int = -mutableProp + mutableProp = 1 + mutableProp += x + ++mutableProp + mutableProp-- + } +} + +public final class A { + @org.jetbrains.annotations.NotNull private var privateProp: int = 0 + @org.jetbrains.annotations.NotNull private var mutableProp: int + public final fun getMutableProp() : int = UastEmptyExpression + public final fun setMutableProp(@null mutableProp: int) : void = UastEmptyExpression + public final fun add(@org.jetbrains.annotations.NotNull x: int) : int { + var result: int = privateProp + privateProp = x + return privateProp + } + public fun A(@org.jetbrains.annotations.NotNull init: int) { + { + mutableProp = init + } + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/PropertyWithAnnotation.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/PropertyWithAnnotation.log.fe10.txt new file mode 100644 index 00000000000..20f5526b1c1 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/PropertyWithAnnotation.log.fe10.txt @@ -0,0 +1,28 @@ +UFile (package = ) + UClass (name = PropertyWithAnnotationKt) + UField (name = prop1) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UAnnotation (fqName = TestAnnotation) + ULiteralExpression (value = 0) + UField (name = prop3) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = 0) + UMethod (name = getProp1) + UMethod (name = getProp2) + UAnnotation (fqName = TestAnnotation) + UBlockExpression + UReturnExpression + ULiteralExpression (value = 0) + UMethod (name = getProp3) + UBlockExpression + UReturnExpression + ULiteralExpression (value = 0) + UMethod (name = setProp3) + UAnnotation (fqName = TestAnnotation) + UParameter (name = value) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UBinaryExpression (operator = =) + USimpleNameReferenceExpression (identifier = field) + USimpleNameReferenceExpression (identifier = value) + UClass (name = TestAnnotation) diff --git a/plugins/uast-kotlin-fir/testData/legacy/PropertyWithAnnotation.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/PropertyWithAnnotation.render.fe10.txt new file mode 100644 index 00000000000..c620ce75671 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/PropertyWithAnnotation.render.fe10.txt @@ -0,0 +1,19 @@ +public final class PropertyWithAnnotationKt { + @org.jetbrains.annotations.NotNull @TestAnnotation private static final var prop1: int = 0 + @org.jetbrains.annotations.NotNull private static var prop3: int = 0 + public static final fun getProp1() : int = UastEmptyExpression + @TestAnnotation + public static final fun getProp2() : int { + return 0 + } + public static final fun getProp3() : int { + return 0 + } + @TestAnnotation + public static final fun setProp3(@org.jetbrains.annotations.NotNull value: int) : void { + field = value + } +} + +public abstract annotation TestAnnotation { +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/QualifiedConstructorCall.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/QualifiedConstructorCall.log.fe10.txt new file mode 100644 index 00000000000..95db97b25a2 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/QualifiedConstructorCall.log.fe10.txt @@ -0,0 +1,17 @@ +UFile (package = A.B.C) + UClass (name = Foo) + UMethod (name = Foo) + UClass (name = Bar) + UMethod (name = getFoo) + UBlockExpression + UReturnExpression + UQualifiedReferenceExpression + UQualifiedReferenceExpression + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = A) + USimpleNameReferenceExpression (identifier = B) + USimpleNameReferenceExpression (identifier = C) + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) + UIdentifier (Identifier (Foo)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: Foo) + UMethod (name = Bar) diff --git a/plugins/uast-kotlin-fir/testData/legacy/QualifiedConstructorCall.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/QualifiedConstructorCall.render.fe10.txt new file mode 100644 index 00000000000..9c004977b1e --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/QualifiedConstructorCall.render.fe10.txt @@ -0,0 +1,12 @@ +package A.B.C + +public final class Foo { + public fun Foo() = UastEmptyExpression +} + +public final class Bar { + public final fun getFoo() : A.B.C.Foo { + return A.B.C.() + } + public fun Bar() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/ReceiverFun.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ReceiverFun.log.fe10.txt new file mode 100644 index 00000000000..5d65edb7622 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ReceiverFun.log.fe10.txt @@ -0,0 +1,25 @@ +UFile (package = ) + UClass (name = ReceiverFunKt) + UMethod (name = foo) + UParameter (name = $this$foo) + UAnnotation (fqName = MyReceiverAnnotation) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + UQualifiedReferenceExpression + UThisExpression (label = null) + USimpleNameReferenceExpression (identifier = length) + UMethod (name = getRx) + UParameter (name = $this$getRx) + UAnnotation (fqName = MyReceiverAnnotation) + UNamedExpression (name = name) + ULiteralExpression (value = "RegExp") + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (toRegex)) + USimpleNameReferenceExpression (identifier = toRegex, resolvesTo = null) + UClass (name = MyReceiverAnnotation) + UAnnotationMethod (name = name) + ULiteralExpression (value = "") diff --git a/plugins/uast-kotlin-fir/testData/legacy/ReceiverFun.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ReceiverFun.render.fe10.txt new file mode 100644 index 00000000000..141eaeb4277 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ReceiverFun.render.fe10.txt @@ -0,0 +1,12 @@ +public final class ReceiverFunKt { + public static final fun foo(@MyReceiverAnnotation @org.jetbrains.annotations.NotNull $this$foo: java.lang.String) : int { + return this.length + } + public static final fun getRx(@MyReceiverAnnotation(name = "RegExp") @org.jetbrains.annotations.NotNull $this$getRx: java.lang.String) : kotlin.text.Regex { + return toRegex() + } +} + +public abstract annotation MyReceiverAnnotation { + public abstract fun name() : java.lang.String = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/Reified.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Reified.log.fe10.txt new file mode 100644 index 00000000000..029694e885d --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Reified.log.fe10.txt @@ -0,0 +1,44 @@ +UFile (package = test.pkg) + UClass (name = ReifiedKt) + UMethod (name = systemService2) + UParameter (name = $this$systemService2) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (getSystemService)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + UQualifiedReferenceExpression + UClassLiteralExpression + USimpleNameReferenceExpression (identifier = java) + UMethod (name = systemService1) + UParameter (name = $this$systemService1) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (getSystemService)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + UQualifiedReferenceExpression + UClassLiteralExpression + USimpleNameReferenceExpression (identifier = java) + UClass (name = Context) + UMethod (name = ownSystemService2) + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (getSystemService)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + UQualifiedReferenceExpression + UClassLiteralExpression + USimpleNameReferenceExpression (identifier = java) + UMethod (name = Context) + UMethod (name = ownSystemService1) + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (getSystemService)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + UQualifiedReferenceExpression + UClassLiteralExpression + USimpleNameReferenceExpression (identifier = java) diff --git a/plugins/uast-kotlin-fir/testData/legacy/Reified.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Reified.render.fe10.txt new file mode 100644 index 00000000000..0c421d4f66c --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Reified.render.fe10.txt @@ -0,0 +1,20 @@ +package test.pkg + +public final class ReifiedKt { + public static final fun systemService2(@org.jetbrains.annotations.NotNull $this$systemService2: test.pkg.Context) : error.NonExistentClass { + return (java.lang.String.java) + } + static fun systemService1(@org.jetbrains.annotations.NotNull $this$systemService1: test.pkg.Context) : { + return (T.java) + } +} + +public final class Context { + public final fun ownSystemService2() : error.NonExistentClass { + return (java.lang.String.java) + } + public fun Context() = UastEmptyExpression + fun ownSystemService1() : { + return (T.java) + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/ReifiedParameters.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ReifiedParameters.log.fe10.txt new file mode 100644 index 00000000000..40cdfa7cd48 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ReifiedParameters.log.fe10.txt @@ -0,0 +1,57 @@ +UFile (package = ) + UClass (name = ReifiedParametersKt) + UMethod (name = functionWithLambda) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = process) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (process)) + USimpleNameReferenceExpression (identifier = invoke, resolvesTo = null) + USimpleNameReferenceExpression (identifier = t) + UMethod (name = functionWithVararg) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UBlockExpression + UReturnExpression + UArrayAccessExpression + USimpleNameReferenceExpression (identifier = t) + ULiteralExpression (value = 0) + UMethod (name = functionWithReceiver) + UParameter (name = $this$functionWithReceiver) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UBlockExpression + UReturnExpression + UThisExpression (label = null) + UMethod (name = name with spaces) + UParameter (name = $this$name with spaces) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UBlockExpression + UReturnExpression + UThisExpression (label = null) + UMethod (name = functionWithParamAnnotation) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UAnnotation (fqName = kotlin.Suppress) + UNamedExpression (name = names) + ULiteralExpression (value = "s") + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = t) + UMethod (name = functionUnresolved) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UAnnotation (fqName = kotlin.Suppress) + UNamedExpression (name = names) + ULiteralExpression (value = "s") + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = t) diff --git a/plugins/uast-kotlin-fir/testData/legacy/ReifiedParameters.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ReifiedParameters.render.fe10.txt new file mode 100644 index 00000000000..3b3b3c9e431 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ReifiedParameters.render.fe10.txt @@ -0,0 +1,20 @@ +public final class ReifiedParametersKt { + static fun functionWithLambda(@org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull process: kotlin.jvm.functions.Function1) : int { + return invoke(t) + } + static fun functionWithVararg(@org.jetbrains.annotations.Nullable i: int, @org.jetbrains.annotations.Nullable t: T) : T { + return t[0] + } + static fun functionWithReceiver(@org.jetbrains.annotations.Nullable $this$functionWithReceiver: T, @org.jetbrains.annotations.Nullable i: int) : T { + return this + } + static fun name with spaces(@org.jetbrains.annotations.Nullable $this$name with spaces: T, @org.jetbrains.annotations.Nullable i: int) : T { + return this + } + static fun functionWithParamAnnotation(@org.jetbrains.annotations.Nullable @kotlin.Suppress(names = "s") t: T) : T { + return t + } + static fun functionUnresolved(@org.jetbrains.annotations.NotNull @kotlin.Suppress(names = "s") t: ) : T { + return t + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/ReifiedResolve.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ReifiedResolve.log.fe10.txt new file mode 100644 index 00000000000..b3576b914da --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ReifiedResolve.log.fe10.txt @@ -0,0 +1,50 @@ +UFile (package = ) + UClass (name = ReifiedResolveKt) + UMethod (name = bar) + UParameter (name = init) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULambdaExpression + UBlockExpression + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (TODO)) + USimpleNameReferenceExpression (identifier = TODO, resolvesTo = null) + ULiteralExpression (value = "message") + UMethod (name = resolve) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (foo)) + USimpleNameReferenceExpression (identifier = foo, resolvesTo = null) + UDeclarationsExpression + ULocalVariable (name = x) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (foo)) + USimpleNameReferenceExpression (identifier = foo, resolvesTo = null) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (bar)) + USimpleNameReferenceExpression (identifier = bar, resolvesTo = null) + UDeclarationsExpression + ULocalVariable (name = y) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (bar)) + USimpleNameReferenceExpression (identifier = bar, resolvesTo = null) + UDeclarationsExpression + ULocalVariable (name = z) + UQualifiedReferenceExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (listOf)) + USimpleNameReferenceExpression (identifier = listOf, resolvesTo = null) + ULiteralExpression (value = "foo") + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (filterIsInstance)) + USimpleNameReferenceExpression (identifier = filterIsInstance, resolvesTo = null) + UMethod (name = foo) + UParameter (name = init) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULambdaExpression + UBlockExpression + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (TODO)) + USimpleNameReferenceExpression (identifier = TODO, resolvesTo = null) + ULiteralExpression (value = "message") diff --git a/plugins/uast-kotlin-fir/testData/legacy/ReifiedResolve.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ReifiedResolve.render.fe10.txt new file mode 100644 index 00000000000..823d868c23b --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ReifiedResolve.render.fe10.txt @@ -0,0 +1,15 @@ +public final class ReifiedResolveKt { + public static final fun bar(@org.jetbrains.annotations.NotNull init: kotlin.jvm.functions.Function1) : T { + TODO("message") + } + public static final fun resolve() : void { + foo() + var x: java.lang.String = foo() + bar() + var y: java.lang.String = bar() + var z: java.util.List = listOf("foo").filterIsInstance() + } + static fun foo(@org.jetbrains.annotations.NotNull init: kotlin.jvm.functions.Function1) : T { + TODO("message") + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/ReifiedReturnType.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ReifiedReturnType.log.fe10.txt new file mode 100644 index 00000000000..3f1f82b5c16 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ReifiedReturnType.log.fe10.txt @@ -0,0 +1,163 @@ +UFile (package = ) + UClass (name = ReifiedReturnTypeKt) + UMethod (name = function1) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = s) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UMethod (name = function2) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = s) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = t) + UMethod (name = function2CharSequence) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = s) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = t) + UMethod (name = copyWhenGreater) + UParameter (name = list) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = threshold) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = threshold2) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = threshold2) + UMethod (name = function3) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = s) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UMethod (name = function4) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = s) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = t) + UMethod (name = function5) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = s) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + ULiteralExpression (value = 42) + UMethod (name = function6) + UParameter (name = $this$function6) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = s) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = t) + UMethod (name = function7) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = s) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = t) + UMethod (name = function8) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = s) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = t) + UMethod (name = function9) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = s) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = t) + UMethod (name = function10) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = s) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = t) + UMethod (name = function11) + UParameter (name = $this$function11) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = s) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = t) + UMethod (name = function11CharSequence) + UParameter (name = $this$function11CharSequence) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = s) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = t) + UMethod (name = function12CharSequence) + UParameter (name = $this$function12CharSequence) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = s) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = t) + UClass (name = Foo) + UMethod (name = Foo) + UMethod (name = foo) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (TODO)) + USimpleNameReferenceExpression (identifier = TODO, resolvesTo = null) diff --git a/plugins/uast-kotlin-fir/testData/legacy/ReifiedReturnType.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ReifiedReturnType.render.fe10.txt new file mode 100644 index 00000000000..8bfad875d53 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ReifiedReturnType.render.fe10.txt @@ -0,0 +1,52 @@ +public final class ReifiedReturnTypeKt { + public static final fun function1(@org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : void { + } + public static final fun function2(@org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : T { + return t + } + public static final fun function2CharSequence(@org.jetbrains.annotations.NotNull t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : T { + return t + } + public static final fun copyWhenGreater(@org.jetbrains.annotations.NotNull list: java.util.List, @org.jetbrains.annotations.NotNull threshold: T, @org.jetbrains.annotations.NotNull threshold2: B) : B { + return threshold2 + } + static fun function3(@org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : void { + } + static fun function4(@org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : T { + return t + } + static fun function5(@org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : int { + return 42 + } + static fun function6(@org.jetbrains.annotations.Nullable $this$function6: T, @org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : T { + return t + } + static fun function7(@org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : T { + return t + } + static fun function8(@org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : T { + return t + } + static fun function9(@org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : T { + return t + } + static fun function10(@org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : T { + return t + } + static fun function11(@org.jetbrains.annotations.Nullable $this$function11: T, @org.jetbrains.annotations.Nullable t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : T { + return t + } + static fun function11CharSequence(@org.jetbrains.annotations.NotNull $this$function11CharSequence: T, @org.jetbrains.annotations.NotNull t: T, @org.jetbrains.annotations.NotNull i: int, @org.jetbrains.annotations.NotNull s: java.lang.String) : T { + return t + } + static fun function12CharSequence(@org.jetbrains.annotations.NotNull $this$function12CharSequence: T, @org.jetbrains.annotations.NotNull t: B, @org.jetbrains.annotations.NotNull i: T, @org.jetbrains.annotations.NotNull s: java.lang.String) : B { + return t + } +} + +public final class Foo { + public fun Foo() = UastEmptyExpression + fun foo() : Z { + TODO() + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/Resolve.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Resolve.log.fe10.txt new file mode 100644 index 00000000000..b475b825b3d --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Resolve.log.fe10.txt @@ -0,0 +1,147 @@ +UFile (package = ) + UClass (name = ResolveKt) + UMethod (name = bar) + UBlockExpression + UQualifiedReferenceExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) + UIdentifier (Identifier (A)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: A) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (foo)) + USimpleNameReferenceExpression (identifier = foo, resolvesTo = null) + UQualifiedReferenceExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) + UIdentifier (Identifier (A)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: A) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (inlineFoo)) + USimpleNameReferenceExpression (identifier = inlineFoo, resolvesTo = null) + UQualifiedReferenceExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (listOf)) + USimpleNameReferenceExpression (identifier = listOf, resolvesTo = null) + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) + UIdentifier (Identifier (A)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: A) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (forEach)) + USimpleNameReferenceExpression (identifier = forEach, resolvesTo = null) + ULambdaExpression + UParameter (name = it) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (println)) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) + USimpleNameReferenceExpression (identifier = it) + UQualifiedReferenceExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (listOf)) + USimpleNameReferenceExpression (identifier = listOf, resolvesTo = null) + ULiteralExpression (value = "") + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (joinToString)) + USimpleNameReferenceExpression (identifier = joinToString, resolvesTo = null) + UQualifiedReferenceExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (listOf)) + USimpleNameReferenceExpression (identifier = listOf, resolvesTo = null) + ULiteralExpression (value = "") + USimpleNameReferenceExpression (identifier = size) + UQualifiedReferenceExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (listOf)) + USimpleNameReferenceExpression (identifier = listOf, resolvesTo = null) + ULiteralExpression (value = "") + USimpleNameReferenceExpression (identifier = indices) + UDeclarationsExpression + ULocalVariable (name = date) + UQualifiedReferenceExpression + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = java) + USimpleNameReferenceExpression (identifier = util) + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) + UIdentifier (Identifier (Date)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: Date) + UBinaryExpression (operator = =) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = date) + USimpleNameReferenceExpression (identifier = time) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (time)) + ULiteralExpression (value = 1000) + ULiteralExpression (value = 1000) + UQualifiedReferenceExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (listOf)) + USimpleNameReferenceExpression (identifier = listOf, resolvesTo = null) + ULiteralExpression (value = "") + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (last)) + USimpleNameReferenceExpression (identifier = last, resolvesTo = null) + UQualifiedReferenceExpression + UQualifiedReferenceExpression + UQualifiedReferenceExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (mutableMapOf)) + USimpleNameReferenceExpression (identifier = mutableMapOf, resolvesTo = null) + UBinaryExpression (operator = ) + ULiteralExpression (value = 1) + ULiteralExpression (value = "1") + USimpleNameReferenceExpression (identifier = entries) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (first)) + USimpleNameReferenceExpression (identifier = first, resolvesTo = null) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (setValue)) + USimpleNameReferenceExpression (identifier = setValue, resolvesTo = null) + ULiteralExpression (value = "123") + UDeclarationsExpression + ULocalVariable (name = intRange) + UBinaryExpression (operator = ..) + ULiteralExpression (value = 0) + ULiteralExpression (value = 3) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = intRange) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (contains)) + USimpleNameReferenceExpression (identifier = contains, resolvesTo = null) + UBinaryExpressionWithType + ULiteralExpression (value = 2) + UTypeReferenceExpression (name = int) + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 2)) + UIdentifier (Identifier (IntRange)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: IntRange) + ULiteralExpression (value = 1) + ULiteralExpression (value = 2) + UMethod (name = barT) + UParameter (name = t) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = t) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (foo)) + USimpleNameReferenceExpression (identifier = foo, resolvesTo = null) + UMethod (name = barTL) + UParameter (name = listT) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = listT) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (isEmpty)) + USimpleNameReferenceExpression (identifier = isEmpty, resolvesTo = null) + UForEachExpression + USimpleNameReferenceExpression (identifier = listT) + UBlockExpression + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = a) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (foo)) + USimpleNameReferenceExpression (identifier = foo, resolvesTo = null) + UClass (name = A) + UMethod (name = foo) + UBlockExpression + UMethod (name = inlineFoo) + UBlockExpression + UMethod (name = A) diff --git a/plugins/uast-kotlin-fir/testData/legacy/Resolve.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Resolve.render.fe10.txt new file mode 100644 index 00000000000..cec0e5e8988 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Resolve.render.fe10.txt @@ -0,0 +1,37 @@ +public final class ResolveKt { + public static final fun bar() : void { + ().foo() + ().inlineFoo() + listOf(()).forEach({ var it: A -> + + println(it) + }) + listOf("").joinToString() + listOf("").size + listOf("").indices + var date: java.util.Date = java.util.() + date.time = 1000 + listOf("").last() + mutableMapOf(1 "1").entries.first().setValue("123") + var intRange: kotlin.ranges.LongRange = 0 .. 3 + intRange.contains(2 as int) + (1, 2) + } + public static final fun barT(@org.jetbrains.annotations.NotNull t: T) : void { + t.foo() + } + public static final fun barTL(@org.jetbrains.annotations.NotNull listT: T) : void { + listT.isEmpty() + for (a : listT) { + a.foo() + } + } +} + +public class A { + public final fun foo() : void { + } + public final fun inlineFoo() : void { + } + public fun A() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/SAM.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/SAM.log.fe10.txt new file mode 100644 index 00000000000..9da28a10e74 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/SAM.log.fe10.txt @@ -0,0 +1,126 @@ +UFile (package = ) + UImportStatement (isOnDemand = false) + UImportStatement (isOnDemand = false) + UImportStatement (isOnDemand = false) + UImportStatement (isOnDemand = false) + UClass (name = SAMKt) + UField (name = notSam) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULambdaExpression + UBlockExpression + UField (name = foo) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULambdaExpression + UBlockExpression + UField (name = baz) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UQualifiedReferenceExpression + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = java) + USimpleNameReferenceExpression (identifier = lang) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (Runnable)) + USimpleNameReferenceExpression (identifier = Runnable, resolvesTo = PsiClass: Runnable) + ULambdaExpression + UBlockExpression + UMethod (name = getNotSam) + UMethod (name = getFoo) + UMethod (name = setFoo) + UParameter (name = foo) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UMethod (name = bar) + UBlockExpression + UBinaryExpression (operator = =) + USimpleNameReferenceExpression (identifier = foo) + ULambdaExpression + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = a) + UBinaryExpressionWithType + ULambdaExpression + UBlockExpression + UTypeReferenceExpression (name = java.lang.Runnable) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (runRunnable)) + USimpleNameReferenceExpression (identifier = runRunnable, resolvesTo = null) + ULambdaExpression + UBlockExpression + UReturnExpression + ULambdaExpression + UBlockExpression + UMethod (name = getBaz) + UMethod (name = runRunnable) + UParameter (name = r) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (r)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + UMethod (name = test1) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = thread1) + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) + UIdentifier (Identifier (Thread)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: Thread) + ULambdaExpression + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (println)) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) + ULiteralExpression (value = "hello1") + UMethod (name = test2) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = thread2) + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) + UIdentifier (Identifier (Thread)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: Thread) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (Runnable)) + USimpleNameReferenceExpression (identifier = Runnable, resolvesTo = PsiClass: Runnable) + ULambdaExpression + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (println)) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) + ULiteralExpression (value = "hello2") + UMethod (name = test3) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (ambiguousSamAcceptor)) + USimpleNameReferenceExpression (identifier = ambiguousSamAcceptor, resolvesTo = null) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (Supplier)) + USimpleNameReferenceExpression (identifier = Supplier, resolvesTo = PsiClass: Supplier) + ULambdaExpression + UBlockExpression + UReturnExpression + ULiteralExpression (value = "Supplier") + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (ambiguousSamAcceptor)) + USimpleNameReferenceExpression (identifier = ambiguousSamAcceptor, resolvesTo = null) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (Callable)) + USimpleNameReferenceExpression (identifier = Callable, resolvesTo = PsiClass: Callable) + ULambdaExpression + UBlockExpression + UReturnExpression + ULiteralExpression (value = "Callable") + UMethod (name = ambiguousSamAcceptor) + UParameter (name = s) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (TODO)) + USimpleNameReferenceExpression (identifier = TODO, resolvesTo = null) + UMethod (name = ambiguousSamAcceptor) + UParameter (name = s) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (TODO)) + USimpleNameReferenceExpression (identifier = TODO, resolvesTo = null) diff --git a/plugins/uast-kotlin-fir/testData/legacy/SAM.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/SAM.render.fe10.txt new file mode 100644 index 00000000000..c20bebd6d9b --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/SAM.render.fe10.txt @@ -0,0 +1,61 @@ +import java.lang.Thread +import java.lang.Runnable +import java.util.concurrent.Callable +import java.util.function.Supplier + +public final class SAMKt { + @org.jetbrains.annotations.NotNull private static final var notSam: kotlin.jvm.functions.Function0 = { + + } + @org.jetbrains.annotations.NotNull private static var foo: java.lang.Runnable = { + + } + @org.jetbrains.annotations.NotNull private static final var baz: java.lang.Runnable = java.lang.Runnable({ + + }) + public static final fun getNotSam() : kotlin.jvm.functions.Function0 = UastEmptyExpression + public static final fun getFoo() : java.lang.Runnable = UastEmptyExpression + public static final fun setFoo(@org.jetbrains.annotations.NotNull foo: java.lang.Runnable) : void = UastEmptyExpression + public static final fun bar() : java.lang.Runnable { + foo = { + + } + var a: java.lang.Runnable = { + + } as java.lang.Runnable + runRunnable({ + + }) + return { + + } + } + public static final fun getBaz() : java.lang.Runnable = UastEmptyExpression + public static final fun runRunnable(@org.jetbrains.annotations.NotNull r: java.lang.Runnable) : error.NonExistentClass { + return () + } + public static final fun test1() : void { + var thread1: java.lang.Thread = ({ + println("hello1") + }) + } + public static final fun test2() : void { + var thread2: java.lang.Thread = (Runnable({ + println("hello2") + })) + } + public static final fun test3() : void { + ambiguousSamAcceptor(Supplier({ + return "Supplier" + })) + ambiguousSamAcceptor(Callable({ + return "Callable" + })) + } + public static final fun ambiguousSamAcceptor(@org.jetbrains.annotations.NotNull s: java.util.function.Supplier) : java.lang.String { + return TODO() + } + public static final fun ambiguousSamAcceptor(@org.jetbrains.annotations.NotNull s: java.util.concurrent.Callable) : java.lang.String { + return TODO() + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/Simple.kt b/plugins/uast-kotlin-fir/testData/legacy/Simple.kt deleted file mode 100644 index 2b841034329..00000000000 --- a/plugins/uast-kotlin-fir/testData/legacy/Simple.kt +++ /dev/null @@ -1,7 +0,0 @@ -class Simple { - fun method() { - println("Hello, world!") - } - - val property: String = "Mary" -} diff --git a/plugins/uast-kotlin-fir/testData/legacy/SimpleAnnotated.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/SimpleAnnotated.log.fe10.txt new file mode 100644 index 00000000000..82c14314d05 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/SimpleAnnotated.log.fe10.txt @@ -0,0 +1,19 @@ +UFile (package = ) + UClass (name = SimpleAnnotated) + UField (name = property) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UAnnotation (fqName = kotlin.SinceKotlin) + UNamedExpression (name = version) + ULiteralExpression (value = "1.0") + ULiteralExpression (value = "Mary") + UMethod (name = method) + UAnnotation (fqName = kotlin.Suppress) + UNamedExpression (name = names) + ULiteralExpression (value = "abc") + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (println)) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) + ULiteralExpression (value = "Hello, world!") + UMethod (name = getProperty) + UMethod (name = SimpleAnnotated) diff --git a/plugins/uast-kotlin-fir/testData/legacy/SimpleAnnotated.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/SimpleAnnotated.render.fe10.txt new file mode 100644 index 00000000000..4375f4bfdaa --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/SimpleAnnotated.render.fe10.txt @@ -0,0 +1,9 @@ +public final class SimpleAnnotated { + @org.jetbrains.annotations.NotNull @kotlin.SinceKotlin(version = "1.0") private final var property: java.lang.String = "Mary" + @kotlin.Suppress(names = "abc") + public final fun method() : void { + println("Hello, world!") + } + public final fun getProperty() : java.lang.String = UastEmptyExpression + public fun SimpleAnnotated() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/StringTemplate.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/StringTemplate.log.fe10.txt new file mode 100644 index 00000000000..1f25dbd51a5 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/StringTemplate.log.fe10.txt @@ -0,0 +1,23 @@ +UFile (package = ) + UClass (name = StringTemplateKt) + UField (name = foo) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = "lorem") + UField (name = bar) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = "ipsum") + UField (name = baz) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = "dolor") + UField (name = foobarbaz) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UPolyadicExpression (operator = +) + USimpleNameReferenceExpression (identifier = foo) + ULiteralExpression (value = " ") + USimpleNameReferenceExpression (identifier = bar) + ULiteralExpression (value = " ") + USimpleNameReferenceExpression (identifier = baz) + UMethod (name = getFoo) + UMethod (name = getBar) + UMethod (name = getBaz) + UMethod (name = getFoobarbaz) diff --git a/plugins/uast-kotlin-fir/testData/legacy/StringTemplate.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/StringTemplate.render.fe10.txt new file mode 100644 index 00000000000..9146c91fb87 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/StringTemplate.render.fe10.txt @@ -0,0 +1,10 @@ +public final class StringTemplateKt { + @org.jetbrains.annotations.NotNull private static final var foo: java.lang.String = "lorem" + @org.jetbrains.annotations.NotNull private static final var bar: java.lang.String = "ipsum" + @org.jetbrains.annotations.NotNull private static final var baz: java.lang.String = "dolor" + @org.jetbrains.annotations.NotNull private static final var foobarbaz: java.lang.String = foo + " " + bar + " " + baz + public static final fun getFoo() : java.lang.String = UastEmptyExpression + public static final fun getBar() : java.lang.String = UastEmptyExpression + public static final fun getBaz() : java.lang.String = UastEmptyExpression + public static final fun getFoobarbaz() : java.lang.String = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/StringTemplateComplex.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/StringTemplateComplex.log.fe10.txt new file mode 100644 index 00000000000..e72af36b37c --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/StringTemplateComplex.log.fe10.txt @@ -0,0 +1,74 @@ +UFile (package = ) + UClass (name = StringTemplateComplexKt) + UField (name = muchRecur) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = "abc") + UField (name = case4) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UPolyadicExpression (operator = +) + ULiteralExpression (value = "a ") + ULiteralExpression (value = "literal") + ULiteralExpression (value = " z") + UField (name = case5) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UPolyadicExpression (operator = +) + ULiteralExpression (value = "a ") + ULiteralExpression (value = "literal") + ULiteralExpression (value = " ") + ULiteralExpression (value = "literal") + ULiteralExpression (value = " z") + UField (name = literalInLiteral) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UPolyadicExpression (operator = +) + ULiteralExpression (value = "a ") + UPolyadicExpression (operator = +) + ULiteralExpression (value = "literal") + USimpleNameReferenceExpression (identifier = case4) + ULiteralExpression (value = " z") + UField (name = literalInLiteral2) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UPolyadicExpression (operator = +) + ULiteralExpression (value = "a ") + UQualifiedReferenceExpression + UPolyadicExpression (operator = +) + ULiteralExpression (value = "literal") + USimpleNameReferenceExpression (identifier = case4) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (repeat)) + USimpleNameReferenceExpression (identifier = repeat, resolvesTo = null) + ULiteralExpression (value = 4) + ULiteralExpression (value = " z") + UField (name = empty) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = "") + UMethod (name = getMuchRecur) + UMethod (name = getCase4) + UMethod (name = getCase5) + UMethod (name = getLiteralInLiteral) + UMethod (name = getLiteralInLiteral2) + UMethod (name = getEmpty) + UMethod (name = simpleForTemplate) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = 0) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = i) + UMethod (name = foo) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (println)) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) + USimpleNameReferenceExpression (identifier = baz) + UDeclarationsExpression + ULocalVariable (name = template1) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (simpleForTemplate)) + USimpleNameReferenceExpression (identifier = simpleForTemplate, resolvesTo = null) + UDeclarationsExpression + ULocalVariable (name = template2) + UPolyadicExpression (operator = +) + ULiteralExpression (value = ".") + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (simpleForTemplate)) + USimpleNameReferenceExpression (identifier = simpleForTemplate, resolvesTo = null) diff --git a/plugins/uast-kotlin-fir/testData/legacy/StringTemplateComplex.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/StringTemplateComplex.render.fe10.txt new file mode 100644 index 00000000000..d85c31e2092 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/StringTemplateComplex.render.fe10.txt @@ -0,0 +1,22 @@ +public final class StringTemplateComplexKt { + @org.jetbrains.annotations.NotNull private static final var muchRecur: java.lang.String = "abc" + @org.jetbrains.annotations.NotNull private static final var case4: java.lang.String = "a " + "literal" + " z" + @org.jetbrains.annotations.NotNull private static final var case5: java.lang.String = "a " + "literal" + " " + "literal" + " z" + @org.jetbrains.annotations.NotNull private static final var literalInLiteral: java.lang.String = "a " + "literal" + case4 + " z" + @org.jetbrains.annotations.NotNull private static final var literalInLiteral2: java.lang.String = "a " + "literal" + case4.repeat(4) + " z" + @org.jetbrains.annotations.NotNull private static final var empty: java.lang.String = "" + public static final fun getMuchRecur() : java.lang.String = UastEmptyExpression + public static final fun getCase4() : java.lang.String = UastEmptyExpression + public static final fun getCase5() : java.lang.String = UastEmptyExpression + public static final fun getLiteralInLiteral() : java.lang.String = UastEmptyExpression + public static final fun getLiteralInLiteral2() : java.lang.String = UastEmptyExpression + public static final fun getEmpty() : java.lang.String = UastEmptyExpression + public static final fun simpleForTemplate(@org.jetbrains.annotations.NotNull i: int) : java.lang.String { + return i + } + public static final fun foo() : void { + println(baz) + var template1: java.lang.String = simpleForTemplate() + var template2: java.lang.String = "." + simpleForTemplate() + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/StringTemplateComplexForUInjectionHost.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/StringTemplateComplexForUInjectionHost.log.fe10.txt new file mode 100644 index 00000000000..ba5bf787632 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/StringTemplateComplexForUInjectionHost.log.fe10.txt @@ -0,0 +1,74 @@ +UFile (package = ) + UClass (name = StringTemplateComplexForUInjectionHostKt) + UField (name = muchRecur) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = "abc") + UField (name = case4) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UPolyadicExpression (operator = +) + ULiteralExpression (value = "a ") + ULiteralExpression (value = "literal") + ULiteralExpression (value = " z") + UField (name = case5) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UPolyadicExpression (operator = +) + ULiteralExpression (value = "a ") + ULiteralExpression (value = "literal") + ULiteralExpression (value = " ") + ULiteralExpression (value = "literal") + ULiteralExpression (value = " z") + UField (name = literalInLiteral) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UPolyadicExpression (operator = +) + ULiteralExpression (value = "a ") + UPolyadicExpression (operator = +) + ULiteralExpression (value = "literal") + USimpleNameReferenceExpression (identifier = case4) + ULiteralExpression (value = " z") + UField (name = literalInLiteral2) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UPolyadicExpression (operator = +) + ULiteralExpression (value = "a ") + UQualifiedReferenceExpression + UPolyadicExpression (operator = +) + ULiteralExpression (value = "literal") + USimpleNameReferenceExpression (identifier = case4) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (repeat)) + USimpleNameReferenceExpression (identifier = repeat, resolvesTo = null) + ULiteralExpression (value = 4) + ULiteralExpression (value = " z") + UField (name = empty) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = "") + UMethod (name = getMuchRecur) + UMethod (name = getCase4) + UMethod (name = getCase5) + UMethod (name = getLiteralInLiteral) + UMethod (name = getLiteralInLiteral2) + UMethod (name = getEmpty) + UMethod (name = simpleForTemplate) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = 0) + UBlockExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = i) + UMethod (name = foo) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (println)) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) + USimpleNameReferenceExpression (identifier = baz) + UDeclarationsExpression + ULocalVariable (name = template1) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (simpleForTemplate)) + USimpleNameReferenceExpression (identifier = simpleForTemplate, resolvesTo = null) + UDeclarationsExpression + ULocalVariable (name = template2) + UPolyadicExpression (operator = +) + ULiteralExpression (value = ".") + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (simpleForTemplate)) + USimpleNameReferenceExpression (identifier = simpleForTemplate, resolvesTo = null) diff --git a/plugins/uast-kotlin-fir/testData/legacy/StringTemplateComplexForUInjectionHost.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/StringTemplateComplexForUInjectionHost.render.fe10.txt new file mode 100644 index 00000000000..100664c9e49 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/StringTemplateComplexForUInjectionHost.render.fe10.txt @@ -0,0 +1,22 @@ +public final class StringTemplateComplexForUInjectionHostKt { + @org.jetbrains.annotations.NotNull private static final var muchRecur: java.lang.String = "abc" + @org.jetbrains.annotations.NotNull private static final var case4: java.lang.String = "a " + "literal" + " z" + @org.jetbrains.annotations.NotNull private static final var case5: java.lang.String = "a " + "literal" + " " + "literal" + " z" + @org.jetbrains.annotations.NotNull private static final var literalInLiteral: java.lang.String = "a " + "literal" + case4 + " z" + @org.jetbrains.annotations.NotNull private static final var literalInLiteral2: java.lang.String = "a " + "literal" + case4.repeat(4) + " z" + @org.jetbrains.annotations.NotNull private static final var empty: java.lang.String = "" + public static final fun getMuchRecur() : java.lang.String = UastEmptyExpression + public static final fun getCase4() : java.lang.String = UastEmptyExpression + public static final fun getCase5() : java.lang.String = UastEmptyExpression + public static final fun getLiteralInLiteral() : java.lang.String = UastEmptyExpression + public static final fun getLiteralInLiteral2() : java.lang.String = UastEmptyExpression + public static final fun getEmpty() : java.lang.String = UastEmptyExpression + public static final fun simpleForTemplate(@org.jetbrains.annotations.NotNull i: int) : java.lang.String { + return i + } + public static final fun foo() : void { + println(baz) + var template1: java.lang.String = simpleForTemplate() + var template2: java.lang.String = "." + simpleForTemplate() + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/StringTemplateInClass.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/StringTemplateInClass.log.fe10.txt new file mode 100644 index 00000000000..da91fadfd88 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/StringTemplateInClass.log.fe10.txt @@ -0,0 +1,12 @@ +UFile (package = ) + UClass (name = Demo) + UField (name = foo) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = X) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (bar)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + ULiteralExpression (value = "lorem") + UMethod (name = getFoo) + UMethod (name = Demo) diff --git a/plugins/uast-kotlin-fir/testData/legacy/StringTemplateInClass.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/StringTemplateInClass.render.fe10.txt new file mode 100644 index 00000000000..5aeb3b5b6b3 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/StringTemplateInClass.render.fe10.txt @@ -0,0 +1,5 @@ +public final class Demo { + @org.jetbrains.annotations.NotNull private final var foo: error.NonExistentClass = X.("lorem") + public final fun getFoo() : error.NonExistentClass = UastEmptyExpression + public fun Demo() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/StringTemplateWithVar.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/StringTemplateWithVar.log.fe10.txt new file mode 100644 index 00000000000..28f77af4e2f --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/StringTemplateWithVar.log.fe10.txt @@ -0,0 +1,12 @@ +UFile (package = ) + UClass (name = StringTemplateWithVarKt) + UField (name = bar) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + ULiteralExpression (value = "bar") + UField (name = f) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UPolyadicExpression (operator = +) + ULiteralExpression (value = "foo") + USimpleNameReferenceExpression (identifier = bar) + UMethod (name = getBar) + UMethod (name = getF) diff --git a/plugins/uast-kotlin-fir/testData/legacy/StringTemplateWithVar.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/StringTemplateWithVar.render.fe10.txt new file mode 100644 index 00000000000..c1fc108a3bf --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/StringTemplateWithVar.render.fe10.txt @@ -0,0 +1,6 @@ +public final class StringTemplateWithVarKt { + @org.jetbrains.annotations.NotNull private static final var bar: java.lang.String = "bar" + @org.jetbrains.annotations.NotNull private static final var f: java.lang.String = "foo" + bar + public static final fun getBar() : java.lang.String = UastEmptyExpression + public static final fun getF() : java.lang.String = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/SuperCalls.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/SuperCalls.log.fe10.txt new file mode 100644 index 00000000000..b85474c2da2 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/SuperCalls.log.fe10.txt @@ -0,0 +1,100 @@ +UFile (package = ) + UClass (name = SuperCallsKt) + UField (name = anon) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UObjectLiteralExpression + ULiteralExpression (value = "textForAnon") + UClass (name = null) + UMethod (name = bar) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (cons)) + USimpleNameReferenceExpression (identifier = cons, resolvesTo = null) + UObjectLiteralExpression + ULiteralExpression (value = "inner literal") + UClass (name = null) + UMethod (name = ) + UMethod (name = ) + UClass (name = InnerClass) + UMethod (name = InnerClass) + UBlockExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) + UIdentifier (Identifier (A)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: A) + ULiteralExpression (value = "inner class") + UMethod (name = getAnon) + UMethod (name = cons) + UParameter (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UClass (name = A) + UField (name = str) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UMethod (name = foo) + UParameter (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UMethod (name = getStr) + UMethod (name = A) + UParameter (name = str) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UMethod (name = A) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) + UIdentifier (Identifier (this)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: A) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = i) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (toString)) + USimpleNameReferenceExpression (identifier = toString, resolvesTo = null) + UClass (name = B) + UMethod (name = B) + UParameter (name = param) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) + UIdentifier (Identifier (A)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: A) + USimpleNameReferenceExpression (identifier = param) + UClass (name = C) + UMethod (name = foo) + UParameter (name = a) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UQualifiedReferenceExpression + USuperExpression (label = null) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (foo)) + USimpleNameReferenceExpression (identifier = foo, resolvesTo = null) + USimpleNameReferenceExpression (identifier = a) + UMethod (name = C) + UParameter (name = p) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) + UIdentifier (Identifier (super)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: A) + USimpleNameReferenceExpression (identifier = p) + UMethod (name = C) + UParameter (name = i) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) + UIdentifier (Identifier (super)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: A) + USimpleNameReferenceExpression (identifier = i) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (println)) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) + UClass (name = O) + UField (name = INSTANCE) + UAnnotation (fqName = null) + UMethod (name = O) + UBlockExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) + UIdentifier (Identifier (A)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: A) + ULiteralExpression (value = "text") diff --git a/plugins/uast-kotlin-fir/testData/legacy/SuperCalls.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/SuperCalls.render.fe10.txt new file mode 100644 index 00000000000..3cadc676fd8 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/SuperCalls.render.fe10.txt @@ -0,0 +1,49 @@ +public final class SuperCallsKt { + @org.jetbrains.annotations.NotNull private static final var anon: A = anonymous object : A("textForAnon") { + fun bar() { + cons(object : A("inner literal") { }) + } + + inner class InnerClass : A("inner class") + } + public static final fun getAnon() : A = UastEmptyExpression + public static final fun cons(@org.jetbrains.annotations.NotNull a: A) : void { + } +} + +public class A { + @org.jetbrains.annotations.NotNull private final var str: java.lang.String + public fun foo(@org.jetbrains.annotations.NotNull a: long) : void { + } + public final fun getStr() : java.lang.String = UastEmptyExpression + public fun A(@org.jetbrains.annotations.NotNull str: java.lang.String) = UastEmptyExpression + public fun A(@org.jetbrains.annotations.NotNull i: int) { + (i.toString()) + } +} + +public final class B : A { + public fun B(@org.jetbrains.annotations.NotNull param: java.lang.String) { + (param) + } +} + +public final class C : A { + public fun foo(@org.jetbrains.annotations.NotNull a: long) : void { + super.foo(a) + } + public fun C(@org.jetbrains.annotations.NotNull p: java.lang.String) { + (p) + } + public fun C(@org.jetbrains.annotations.NotNull i: int) { + (i) + println() + } +} + +public final class O : A { + @null public static final var INSTANCE: O + private fun O() { + ("text") + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/Suspend.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Suspend.log.fe10.txt new file mode 100644 index 00000000000..fbab5351d41 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Suspend.log.fe10.txt @@ -0,0 +1,32 @@ +UFile (package = test.pkg) + UClass (name = SuspendKt) + UMethod (name = top) + UParameter (name = $completion) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + UQualifiedReferenceExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) + UIdentifier (Identifier (Context)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: Context) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (inner)) + USimpleNameReferenceExpression (identifier = inner, resolvesTo = null) + UClass (name = Context) + UMethod (name = inner) + UParameter (name = $completion) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (suspendPrivate)) + USimpleNameReferenceExpression (identifier = suspendPrivate, resolvesTo = null) + UMethod (name = suspendPrivate) + UParameter (name = $completion) + UAnnotation (fqName = null) + UBlockExpression + UReturnExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (inner)) + USimpleNameReferenceExpression (identifier = inner, resolvesTo = null) + UMethod (name = Context) diff --git a/plugins/uast-kotlin-fir/testData/legacy/Suspend.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/Suspend.render.fe10.txt new file mode 100644 index 00000000000..ad70e4d78d1 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/Suspend.render.fe10.txt @@ -0,0 +1,17 @@ +package test.pkg + +public final class SuspendKt { + public static final fun top(@org.jetbrains.annotations.NotNull $completion: kotlin.coroutines.Continuation) : java.lang.Object { + return ().inner() + } +} + +public final class Context { + public final fun inner(@org.jetbrains.annotations.NotNull $completion: kotlin.coroutines.Continuation) : java.lang.Object { + return suspendPrivate() + } + private final fun suspendPrivate(@null $completion: kotlin.coroutines.Continuation) : java.lang.Object { + return inner() + } + public fun Context() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/TryCatch.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/TryCatch.log.fe10.txt new file mode 100644 index 00000000000..c53ba2040c9 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/TryCatch.log.fe10.txt @@ -0,0 +1,59 @@ +UFile (package = ) + UClass (name = TryCatch) + UMethod (name = catches) + UBlockExpression + UTryExpression + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (body)) + USimpleNameReferenceExpression (identifier = body, resolvesTo = null) + UCatchClause (e) + UParameter (name = e) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (catcher)) + USimpleNameReferenceExpression (identifier = catcher, resolvesTo = null) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (finalizer)) + USimpleNameReferenceExpression (identifier = finalizer, resolvesTo = null) + UMethod (name = body) + UBlockExpression + UMethod (name = catcher) + UBlockExpression + UMethod (name = finalizer) + UBlockExpression + UMethod (name = TryCatch) + UClass (name = TryCatchAnnotations) + UMethod (name = catches) + UAnnotation (fqName = java.lang.SuppressWarnings) + UNamedExpression (name = value) + ULiteralExpression (value = "Something") + UBlockExpression + UTryExpression + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (body)) + USimpleNameReferenceExpression (identifier = body, resolvesTo = null) + UCatchClause (e) + UParameter (name = e) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UAnnotation (fqName = java.lang.SuppressWarnings) + UNamedExpression (name = value) + ULiteralExpression (value = "Something") + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (catcher)) + USimpleNameReferenceExpression (identifier = catcher, resolvesTo = null) + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (finalizer)) + USimpleNameReferenceExpression (identifier = finalizer, resolvesTo = null) + UMethod (name = body) + UBlockExpression + UMethod (name = catcher) + UBlockExpression + UMethod (name = finalizer) + UBlockExpression + UMethod (name = TryCatchAnnotations) diff --git a/plugins/uast-kotlin-fir/testData/legacy/TryCatch.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/TryCatch.render.fe10.txt new file mode 100644 index 00000000000..d727d59bce5 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/TryCatch.render.fe10.txt @@ -0,0 +1,42 @@ +public final class TryCatch { + public final fun catches() : void { + try { + body() + } + catch (@org.jetbrains.annotations.NotNull var e: java.lang.Throwable) { + catcher() + } + finally { + finalizer() + } + } + public final fun body() : void { + } + public final fun catcher() : void { + } + public final fun finalizer() : void { + } + public fun TryCatch() = UastEmptyExpression +} + +public final class TryCatchAnnotations { + @java.lang.SuppressWarnings(value = "Something") + public final fun catches() : void { + try { + body() + } + catch (@org.jetbrains.annotations.NotNull @java.lang.SuppressWarnings(value = "Something") var e: java.lang.Throwable) { + catcher() + } + finally { + finalizer() + } + } + public final fun body() : void { + } + public final fun catcher() : void { + } + public final fun finalizer() : void { + } + public fun TryCatchAnnotations() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/TypeAliasExpansionWithOtherAliasInArgument.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/TypeAliasExpansionWithOtherAliasInArgument.log.fe10.txt new file mode 100644 index 00000000000..b78a173daca --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/TypeAliasExpansionWithOtherAliasInArgument.log.fe10.txt @@ -0,0 +1,18 @@ +UFile (package = ) + UClass (name = TypeAliasExpansionWithOtherAliasInArgumentKt) + UMethod (name = foo) + UParameter (name = $this$foo) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = x) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + ULiteralExpression (value = null) + UMethod (name = bar) + UParameter (name = $this$bar) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = x) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + ULiteralExpression (value = null) diff --git a/plugins/uast-kotlin-fir/testData/legacy/TypeAliasExpansionWithOtherAliasInArgument.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/TypeAliasExpansionWithOtherAliasInArgument.render.fe10.txt new file mode 100644 index 00000000000..15f95397c7e --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/TypeAliasExpansionWithOtherAliasInArgument.render.fe10.txt @@ -0,0 +1,8 @@ +public final class TypeAliasExpansionWithOtherAliasInArgumentKt { + public static final fun foo(@org.jetbrains.annotations.NotNull $this$foo: kotlin.jvm.functions.Function1,kotlin.Unit>, @org.jetbrains.annotations.NotNull x: kotlin.jvm.functions.Function1,kotlin.Unit>) : kotlin.jvm.functions.Function1,kotlin.Unit> { + return null + } + public static final fun bar(@org.jetbrains.annotations.NotNull $this$bar: java.util.Map, @org.jetbrains.annotations.NotNull x: java.util.Map) : java.util.Map { + return null + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/TypeAliases.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/TypeAliases.log.fe10.txt new file mode 100644 index 00000000000..b3e314b4b4b --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/TypeAliases.log.fe10.txt @@ -0,0 +1,4 @@ +UFile (package = ) + UClass (name = TypeAliasesKt) + UClass (name = A) + UMethod (name = A) diff --git a/plugins/uast-kotlin-fir/testData/legacy/TypeAliases.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/TypeAliases.render.fe10.txt new file mode 100644 index 00000000000..b50c7515562 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/TypeAliases.render.fe10.txt @@ -0,0 +1,6 @@ +public final class TypeAliasesKt { +} + +public final class A { + public fun A() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/TypeInAnnotation.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/TypeInAnnotation.log.fe10.txt new file mode 100644 index 00000000000..34419431822 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/TypeInAnnotation.log.fe10.txt @@ -0,0 +1,5 @@ +UFile (package = ) + UClass (name = C) + UMethod (name = foo) + UBlockExpression + UMethod (name = C) diff --git a/plugins/uast-kotlin-fir/testData/legacy/TypeInAnnotation.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/TypeInAnnotation.render.fe10.txt new file mode 100644 index 00000000000..7d89fb30546 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/TypeInAnnotation.render.fe10.txt @@ -0,0 +1,5 @@ +public final class C { + public final fun foo() : void { + } + public fun C() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/TypeReferences.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/TypeReferences.log.fe10.txt new file mode 100644 index 00000000000..22bf5afa528 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/TypeReferences.log.fe10.txt @@ -0,0 +1,72 @@ +UFile (package = ) + UClass (name = TypeReferencesKt) + UMethod (name = foo) + UParameter (name = parameter) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = varWithType) + ULiteralExpression (value = "Not Null") + UDeclarationsExpression + ULocalVariable (name = varWithoutType) + ULiteralExpression (value = "lorem ipsum") + UDeclarationsExpression + ULocalVariable (name = result) + UBinaryExpression (operator = +) + USimpleNameReferenceExpression (identifier = varWithType) + USimpleNameReferenceExpression (identifier = varWithoutType) + UReturnExpression + USimpleNameReferenceExpression (identifier = result) + UMethod (name = parameterizedFoo) + UParameter (name = arg) + UAnnotation (fqName = org.jetbrains.annotations.Nullable) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = a) + USimpleNameReferenceExpression (identifier = arg) + UDeclarationsExpression + ULocalVariable (name = at) + UExpressionList (elvis) + UDeclarationsExpression + ULocalVariable (name = var708e267b) + USimpleNameReferenceExpression (identifier = arg) + UIfExpression + UBinaryExpression (operator = !=) + USimpleNameReferenceExpression (identifier = var708e267b) + ULiteralExpression (value = null) + USimpleNameReferenceExpression (identifier = var708e267b) + UReturnExpression + UDeclarationsExpression + ULocalVariable (name = tl) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (listOf)) + USimpleNameReferenceExpression (identifier = listOf, resolvesTo = null) + USimpleNameReferenceExpression (identifier = at) + UDeclarationsExpression + ULocalVariable (name = tsl) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = tl) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (map)) + USimpleNameReferenceExpression (identifier = map, resolvesTo = null) + ULambdaExpression + UParameter (name = it) + UBlockExpression + UReturnExpression + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = it) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (toString)) + USimpleNameReferenceExpression (identifier = toString, resolvesTo = null) + UDeclarationsExpression + ULocalVariable (name = lls) + UDeclarationsExpression + ULocalVariable (name = llsAliased) + UDeclarationsExpression + ULocalVariable (name = llt) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (parameterizedFoo)) + USimpleNameReferenceExpression (identifier = parameterizedFoo, resolvesTo = null) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (emptyList)) + USimpleNameReferenceExpression (identifier = emptyList, resolvesTo = null) diff --git a/plugins/uast-kotlin-fir/testData/legacy/TypeReferences.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/TypeReferences.render.fe10.txt new file mode 100644 index 00000000000..56f39269ff4 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/TypeReferences.render.fe10.txt @@ -0,0 +1,24 @@ +public final class TypeReferencesKt { + public static final fun foo(@org.jetbrains.annotations.NotNull parameter: int) : java.lang.String { + var varWithType: java.lang.String = "Not Null" + var varWithoutType: java.lang.String = "lorem ipsum" + var result: java.lang.String = varWithType + varWithoutType + return result + } + public static final fun parameterizedFoo(@org.jetbrains.annotations.Nullable arg: T) : void { + var a: T = arg + var at: T = elvis { + var var708e267b: T = arg + if (var708e267b != null) var708e267b else return + } + var tl: java.util.List = listOf(at) + var tsl: java.util.List = tl.map({ var it: T -> + + return it.toString() + }) + var lls: java.util.List> + var llsAliased: java.util.List> + var llt: java.util.List> + parameterizedFoo(emptyList()) + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/UnexpectedContainerException.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/UnexpectedContainerException.log.fe10.txt new file mode 100644 index 00000000000..6e2ea159de7 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/UnexpectedContainerException.log.fe10.txt @@ -0,0 +1,40 @@ +UFile (package = ) + UClass (name = Callback) + UMethod (name = onError) + UParameter (name = throwable) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UClass (name = Model) + UMethod (name = crashMe) + UParameter (name = clazz) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UParameter (name = factory) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UThrowExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) + UIdentifier (Identifier (UnsupportedOperationException)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: UnsupportedOperationException) + UMethod (name = Model) + UBlockExpression + UBlockExpression + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) + UIdentifier (Identifier (crashMe)) + USimpleNameReferenceExpression (identifier = crashMe, resolvesTo = null) + UQualifiedReferenceExpression + UClassLiteralExpression + USimpleNameReferenceExpression (identifier = java) + ULambdaExpression + UBlockExpression + UReturnExpression + UObjectLiteralExpression + UClass (name = null) + UMethod (name = onError) + UParameter (name = throwable) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UThrowExpression + UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) + UIdentifier (Identifier (UnsupportedOperationException)) + USimpleNameReferenceExpression (identifier = , resolvesTo = PsiClass: UnsupportedOperationException) + ULiteralExpression (value = "") + UMethod (name = ) diff --git a/plugins/uast-kotlin-fir/testData/legacy/UnexpectedContainerException.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/UnexpectedContainerException.render.fe10.txt new file mode 100644 index 00000000000..2dce43115b2 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/UnexpectedContainerException.render.fe10.txt @@ -0,0 +1,20 @@ +public abstract interface Callback { + public abstract fun onError(@org.jetbrains.annotations.NotNull throwable: java.lang.Throwable) : void = UastEmptyExpression +} + +public final class Model { + public final fun crashMe(@org.jetbrains.annotations.NotNull clazz: java.lang.Class, @org.jetbrains.annotations.NotNull factory: kotlin.jvm.functions.Function0) : void { + throw () + } + public fun Model() { + { + crashMe(Callback.java, { + return anonymous object : Callback { + override fun onError(throwable: Throwable) { + throw UnsupportedOperationException("") + } + } + }) + } + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/WhenAndDestructing.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/WhenAndDestructing.log.fe10.txt new file mode 100644 index 00000000000..b22958107f6 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/WhenAndDestructing.log.fe10.txt @@ -0,0 +1,48 @@ +UFile (package = ) + UClass (name = WhenAndDestructingKt) + UMethod (name = getElementsAdditionalResolve) + UParameter (name = string) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = arr) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) + UIdentifier (Identifier (listOf)) + USimpleNameReferenceExpression (identifier = listOf, resolvesTo = null) + ULiteralExpression (value = "1") + ULiteralExpression (value = "2") + USwitchExpression + USimpleNameReferenceExpression (identifier = string) + UExpressionList (when) + USwitchClauseExpressionWithBody + ULiteralExpression (value = "aaaa") + UExpressionList (when_entry) + UYieldExpression + UReturnExpression + ULiteralExpression (value = "bindingContext") + USwitchClauseExpressionWithBody + ULiteralExpression (value = "empty-switch") + UExpressionList (when_entry) + USwitchClauseExpressionWithBody + UExpressionList (when_entry) + UDeclarationsExpression + ULocalVariable (name = var837f25e0) + UAnnotation (fqName = null) + USimpleNameReferenceExpression (identifier = arr) + ULocalVariable (name = bindingContext) + UAnnotation (fqName = null) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = var837f25e0) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (component1)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + ULocalVariable (name = statementFilter) + UAnnotation (fqName = null) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = var837f25e0) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (component2)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + UYieldExpression + UReturnExpression + USimpleNameReferenceExpression (identifier = bindingContext) diff --git a/plugins/uast-kotlin-fir/testData/legacy/WhenAndDestructing.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/WhenAndDestructing.render.fe10.txt new file mode 100644 index 00000000000..a9f9fce943b --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/WhenAndDestructing.render.fe10.txt @@ -0,0 +1,22 @@ +public final class WhenAndDestructingKt { + public static final fun getElementsAdditionalResolve(@org.jetbrains.annotations.NotNull string: java.lang.String) : java.lang.String { + var arr: java.util.List = listOf("1", "2") + switch (string) { + "aaaa" -> { + yield return "bindingContext" + } + + "empty-switch" -> { + } + + -> { + @null var var837f25e0: = arr + @null var bindingContext: java.lang.String = var837f25e0.() + @null var statementFilter: java.lang.String = var837f25e0.() + yield return bindingContext + } + + } + + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/WhenIs.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/WhenIs.log.fe10.txt new file mode 100644 index 00000000000..ae871ce7762 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/WhenIs.log.fe10.txt @@ -0,0 +1,24 @@ +UFile (package = ) + UClass (name = WhenIsKt) + UMethod (name = foo) + UParameter (name = bar) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + UBlockExpression + UReturnExpression + USwitchExpression + USimpleNameReferenceExpression (identifier = bar) + UExpressionList (when) + USwitchClauseExpressionWithBody + UBinaryExpressionWithType + USimpleNameReferenceExpression (identifier = it) + UTypeReferenceExpression (name = java.lang.String) + UExpressionList (when_entry) + UYieldExpression + USimpleNameReferenceExpression (identifier = bar) + USwitchClauseExpressionWithBody + UBinaryExpressionWithType + USimpleNameReferenceExpression (identifier = it) + UTypeReferenceExpression (name = java.lang.String) + UExpressionList (when_entry) + UYieldExpression + ULiteralExpression (value = "") diff --git a/plugins/uast-kotlin-fir/testData/legacy/WhenIs.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/WhenIs.render.fe10.txt new file mode 100644 index 00000000000..e144f523bed --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/WhenIs.render.fe10.txt @@ -0,0 +1,15 @@ +public final class WhenIsKt { + public static final fun foo(@org.jetbrains.annotations.NotNull bar: java.lang.Object) : java.lang.String { + return switch (bar) { + it is java.lang.String -> { + yield bar + } + + it !is java.lang.String -> { + yield "" + } + + } + + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/WhenStringLiteral.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/WhenStringLiteral.log.fe10.txt new file mode 100644 index 00000000000..f58b40c2640 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/WhenStringLiteral.log.fe10.txt @@ -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, resolvesTo = null) + UField (name = b) + UAnnotation (fqName = org.jetbrains.annotations.NotNull) + USwitchExpression + USimpleNameReferenceExpression (identifier = a) + UExpressionList (when) + USwitchClauseExpressionWithBody + ULiteralExpression (value = "abc") + UExpressionList (when_entry) + UYieldExpression + ULiteralExpression (value = 1) + USwitchClauseExpressionWithBody + ULiteralExpression (value = "def") + ULiteralExpression (value = "ghi") + UExpressionList (when_entry) + UYieldExpression + ULiteralExpression (value = 2) + USwitchClauseExpressionWithBody + UExpressionList (when_entry) + UYieldExpression + ULiteralExpression (value = 3) + UMethod (name = getA) + UMethod (name = getB) + UMethod (name = ) + UBlockExpression + ULiteralExpression (value = "abc1") + ULiteralExpression (value = "def1") diff --git a/plugins/uast-kotlin-fir/testData/legacy/WhenStringLiteral.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/WhenStringLiteral.render.fe10.txt new file mode 100644 index 00000000000..42ce7f2a119 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/WhenStringLiteral.render.fe10.txt @@ -0,0 +1,24 @@ +public final class WhenStringLiteralKt { + @org.jetbrains.annotations.Nullable private static final var a: java.lang.String = readLine() + @org.jetbrains.annotations.NotNull private static final var b: int = switch (a) { + "abc" -> { + yield 1 + } + + "def", "ghi" -> { + yield 2 + } + + -> { + yield 3 + } + + } + + public static final fun getA() : java.lang.String = UastEmptyExpression + public static final fun getB() : int = UastEmptyExpression + public static final fun () : void { + "abc1" + "def1" + } +} diff --git a/plugins/uast-kotlin-fir/testData/legacy/ea101715.log.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ea101715.log.fe10.txt new file mode 100644 index 00000000000..5da674d177e --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ea101715.log.fe10.txt @@ -0,0 +1,14 @@ +UFile (package = ) + UClass (name = Ea101715Kt) + UMethod (name = a) + UBlockExpression + UDeclarationsExpression + ULocalVariable (name = a) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) + UIdentifier (Identifier (Obj)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + ULiteralExpression (value = 555) + UClass (name = Obj) + UField (name = INSTANCE) + UAnnotation (fqName = null) + UMethod (name = Obj) diff --git a/plugins/uast-kotlin-fir/testData/legacy/ea101715.render.fe10.txt b/plugins/uast-kotlin-fir/testData/legacy/ea101715.render.fe10.txt new file mode 100644 index 00000000000..43eafeb40f4 --- /dev/null +++ b/plugins/uast-kotlin-fir/testData/legacy/ea101715.render.fe10.txt @@ -0,0 +1,10 @@ +public final class Ea101715Kt { + public static final fun a() : void { + var a: = (555) + } +} + +public final class Obj { + @null public static final var INSTANCE: Obj + private fun Obj() = UastEmptyExpression +} diff --git a/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/common/kotlin/FirLegacyUastRenderLogTestBase.kt b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/common/kotlin/FirLegacyUastRenderLogTestBase.kt new file mode 100644 index 00000000000..bad2f5eb8ef --- /dev/null +++ b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/common/kotlin/FirLegacyUastRenderLogTestBase.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.uast.common.kotlin + +import java.io.File + +interface FirLegacyUastRenderLogTestBase : FirUastRenderLogTestBase { + override fun getTestMetadataFileFromPath(filePath: String, ext: String): File { + // We're using test files from .../uast-kotlin/testData/... + // but want to store metadata under .../uast-kotlin-fir/testData/legacy/... + val revisedFilePath = + filePath.replace("uast-kotlin", "uast-kotlin-fir").replace("testData", "testData/legacy") + return super.getTestMetadataFileFromPath(revisedFilePath, ext) + } +} diff --git a/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/common/kotlin/FirUastRenderLogTestBase.kt b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/common/kotlin/FirUastRenderLogTestBase.kt index b2265de1760..9d88f5776d1 100644 --- a/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/common/kotlin/FirUastRenderLogTestBase.kt +++ b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/common/kotlin/FirUastRenderLogTestBase.kt @@ -11,12 +11,12 @@ import org.jetbrains.uast.asRecursiveLogString import java.io.File interface FirUastRenderLogTestBase : FirUastPluginSelection { - fun getTestFileFromPath(filePath: String, ext: String): File { + fun getTestMetadataFileFromPath(filePath: String, ext: String): File { return File(filePath.removeSuffix(".kt") + '.' + ext) } - private fun getRenderFile(filePath: String) = getTestFileFromPath(filePath, "render$pluginSuffix.txt") - private fun getLogFile(filePath: String) = getTestFileFromPath(filePath, "log$pluginSuffix.txt") + private fun getRenderFile(filePath: String) = getTestMetadataFileFromPath(filePath, "render$pluginSuffix.txt") + private fun getLogFile(filePath: String) = getTestMetadataFileFromPath(filePath, "log$pluginSuffix.txt") fun check(filePath: String, file: UFile) { val renderFile = getRenderFile(filePath) diff --git a/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/env/kotlin/AbstractFirUastTest.kt b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/env/kotlin/AbstractFirUastTest.kt index fc788cd1d92..c7e5911fd26 100644 --- a/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/env/kotlin/AbstractFirUastTest.kt +++ b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/env/kotlin/AbstractFirUastTest.kt @@ -14,6 +14,7 @@ import com.intellij.testFramework.registerServiceInstance import com.intellij.util.io.URLUtil import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor +import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.uast.UFile import org.jetbrains.uast.UastFacade import org.jetbrains.uast.UastLanguagePlugin @@ -24,6 +25,15 @@ import org.jetbrains.uast.kotlin.internal.FirCliKotlinUastResolveProviderService import java.io.File abstract class AbstractFirUastTest : KotlinLightCodeInsightFixtureTestCase(), FirUastPluginSelection { + companion object { + private const val IGNORE_FIR_DIRECTIVE = "IGNORE_FIR" + + val String.withIgnoreFirDirective: Boolean + get() { + return IGNORE_FIR_DIRECTIVE in KotlinTestUtils.parseDirectives(this) + } + } + private fun registerExtensionPointAndServiceIfNeeded() { if (!isFirPlugin) return @@ -62,7 +72,10 @@ abstract class AbstractFirUastTest : KotlinLightCodeInsightFixtureTestCase(), Fi val virtualFile = getVirtualFile(filePath) val testName = filePath.substring(filePath.lastIndexOf('/') + 1).removeSuffix(".kt") - val psiFile = myFixture.configureByText(virtualFile.name, File(virtualFile.canonicalPath!!).readText()) + val fileContent = File(virtualFile.canonicalPath!!).readText() + if (isFirPlugin && fileContent.withIgnoreFirDirective) return + + val psiFile = myFixture.configureByText(virtualFile.name, fileContent) val uFile = UastFacade.convertElementWithParent(psiFile, null) ?: error("Can't get UFile for $testName") checkCallback(filePath, uFile as UFile) } diff --git a/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/AbstractFE1LegacyUastDeclarationTest.kt b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/AbstractFE1LegacyUastDeclarationTest.kt new file mode 100644 index 00000000000..2afccf1e503 --- /dev/null +++ b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/AbstractFE1LegacyUastDeclarationTest.kt @@ -0,0 +1,10 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.uast.test.kotlin + +import org.jetbrains.uast.common.kotlin.FirLegacyUastRenderLogTestBase + +abstract class AbstractFE1LegacyUastDeclarationTest : AbstractFE1UastDeclarationTest(), FirLegacyUastRenderLogTestBase diff --git a/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/AbstractFirLegacyUastDeclarationTest.kt b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/AbstractFirLegacyUastDeclarationTest.kt new file mode 100644 index 00000000000..49df4683c24 --- /dev/null +++ b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/AbstractFirLegacyUastDeclarationTest.kt @@ -0,0 +1,10 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.uast.test.kotlin + +import org.jetbrains.uast.common.kotlin.FirLegacyUastRenderLogTestBase + +abstract class AbstractFirLegacyUastDeclarationTest : AbstractFirUastDeclarationTest(), FirLegacyUastRenderLogTestBase diff --git a/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FE1LegacyUastDeclarationTestGenerated.java b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FE1LegacyUastDeclarationTestGenerated.java new file mode 100644 index 00000000000..78628c599d0 --- /dev/null +++ b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FE1LegacyUastDeclarationTestGenerated.java @@ -0,0 +1,381 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.uast.test.kotlin; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.util.KtTestUtil; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("plugins/uast-kotlin/testData") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class FE1LegacyUastDeclarationTestGenerated extends AbstractFE1LegacyUastDeclarationTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInTestData() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/uast-kotlin/testData"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("AnnotatedExpressions.kt") + public void testAnnotatedExpressions() throws Exception { + runTest("plugins/uast-kotlin/testData/AnnotatedExpressions.kt"); + } + + @TestMetadata("AnnotationComplex.kt") + public void testAnnotationComplex() throws Exception { + runTest("plugins/uast-kotlin/testData/AnnotationComplex.kt"); + } + + @TestMetadata("AnnotationParameters.kt") + public void testAnnotationParameters() throws Exception { + runTest("plugins/uast-kotlin/testData/AnnotationParameters.kt"); + } + + @TestMetadata("Anonymous.kt") + public void testAnonymous() throws Exception { + runTest("plugins/uast-kotlin/testData/Anonymous.kt"); + } + + @TestMetadata("Assertion.kt") + public void testAssertion() throws Exception { + runTest("plugins/uast-kotlin/testData/Assertion.kt"); + } + + @TestMetadata("Bitwise.kt") + public void testBitwise() throws Exception { + runTest("plugins/uast-kotlin/testData/Bitwise.kt"); + } + + @TestMetadata("BrokenMethod.kt") + public void testBrokenMethod() throws Exception { + runTest("plugins/uast-kotlin/testData/BrokenMethod.kt"); + } + + @TestMetadata("ClassAnnotation.kt") + public void testClassAnnotation() throws Exception { + runTest("plugins/uast-kotlin/testData/ClassAnnotation.kt"); + } + + @TestMetadata("ConstructorDelegate.kt") + public void testConstructorDelegate() throws Exception { + runTest("plugins/uast-kotlin/testData/ConstructorDelegate.kt"); + } + + @TestMetadata("Constructors.kt") + public void testConstructors() throws Exception { + runTest("plugins/uast-kotlin/testData/Constructors.kt"); + } + + @TestMetadata("CycleInTypeParameters.kt") + public void testCycleInTypeParameters() throws Exception { + runTest("plugins/uast-kotlin/testData/CycleInTypeParameters.kt"); + } + + @TestMetadata("DefaultImpls.kt") + public void testDefaultImpls() throws Exception { + runTest("plugins/uast-kotlin/testData/DefaultImpls.kt"); + } + + @TestMetadata("DefaultParameterValues.kt") + public void testDefaultParameterValues() throws Exception { + runTest("plugins/uast-kotlin/testData/DefaultParameterValues.kt"); + } + + @TestMetadata("Delegate.kt") + public void testDelegate() throws Exception { + runTest("plugins/uast-kotlin/testData/Delegate.kt"); + } + + @TestMetadata("DeprecatedHidden.kt") + public void testDeprecatedHidden() throws Exception { + runTest("plugins/uast-kotlin/testData/DeprecatedHidden.kt"); + } + + @TestMetadata("DestructuringDeclaration.kt") + public void testDestructuringDeclaration() throws Exception { + runTest("plugins/uast-kotlin/testData/DestructuringDeclaration.kt"); + } + + @TestMetadata("ea101715.kt") + public void testEa101715() throws Exception { + runTest("plugins/uast-kotlin/testData/ea101715.kt"); + } + + @TestMetadata("Elvis.kt") + public void testElvis() throws Exception { + runTest("plugins/uast-kotlin/testData/Elvis.kt"); + } + + @TestMetadata("ElvisType.kt") + public void testElvisType() throws Exception { + runTest("plugins/uast-kotlin/testData/ElvisType.kt"); + } + + @TestMetadata("EnumValueMembers.kt") + public void testEnumValueMembers() throws Exception { + runTest("plugins/uast-kotlin/testData/EnumValueMembers.kt"); + } + + @TestMetadata("EnumValuesConstructors.kt") + public void testEnumValuesConstructors() throws Exception { + runTest("plugins/uast-kotlin/testData/EnumValuesConstructors.kt"); + } + + @TestMetadata("IfStatement.kt") + public void testIfStatement() throws Exception { + runTest("plugins/uast-kotlin/testData/IfStatement.kt"); + } + + @TestMetadata("Imports.kt") + public void testImports() throws Exception { + runTest("plugins/uast-kotlin/testData/Imports.kt"); + } + + @TestMetadata("In.kt") + public void testIn() throws Exception { + runTest("plugins/uast-kotlin/testData/In.kt"); + } + + @TestMetadata("InferenceInsideUnresolvedConstructor.kt") + public void testInferenceInsideUnresolvedConstructor() throws Exception { + runTest("plugins/uast-kotlin/testData/InferenceInsideUnresolvedConstructor.kt"); + } + + @TestMetadata("InnerClasses.kt") + public void testInnerClasses() throws Exception { + runTest("plugins/uast-kotlin/testData/InnerClasses.kt"); + } + + @TestMetadata("InnerNonFixedTypeVariable.kt") + public void testInnerNonFixedTypeVariable() throws Exception { + runTest("plugins/uast-kotlin/testData/InnerNonFixedTypeVariable.kt"); + } + + @TestMetadata("LambdaReturn.kt") + public void testLambdaReturn() throws Exception { + runTest("plugins/uast-kotlin/testData/LambdaReturn.kt"); + } + + @TestMetadata("Lambdas.kt") + public void testLambdas() throws Exception { + runTest("plugins/uast-kotlin/testData/Lambdas.kt"); + } + + @TestMetadata("LocalDeclarations.kt") + public void testLocalDeclarations() throws Exception { + runTest("plugins/uast-kotlin/testData/LocalDeclarations.kt"); + } + + @TestMetadata("LocalVariableWithAnnotation.kt") + public void testLocalVariableWithAnnotation() throws Exception { + runTest("plugins/uast-kotlin/testData/LocalVariableWithAnnotation.kt"); + } + + @TestMetadata("ManyAlternatives.kt") + public void testManyAlternatives() throws Exception { + runTest("plugins/uast-kotlin/testData/ManyAlternatives.kt"); + } + + @TestMetadata("MethodReference.kt") + public void testMethodReference() throws Exception { + runTest("plugins/uast-kotlin/testData/MethodReference.kt"); + } + + @TestMetadata("NameContainingFile.kt") + public void testNameContainingFile() throws Exception { + runTest("plugins/uast-kotlin/testData/NameContainingFile.kt"); + } + + @TestMetadata("NonTrivialIdentifiers.kt") + public void testNonTrivialIdentifiers() throws Exception { + runTest("plugins/uast-kotlin/testData/NonTrivialIdentifiers.kt"); + } + + @TestMetadata("ParameterPropertyWithAnnotation.kt") + public void testParameterPropertyWithAnnotation() throws Exception { + runTest("plugins/uast-kotlin/testData/ParameterPropertyWithAnnotation.kt"); + } + + @TestMetadata("ParametersDisorder.kt") + public void testParametersDisorder() throws Exception { + runTest("plugins/uast-kotlin/testData/ParametersDisorder.kt"); + } + + @TestMetadata("ParametersWithDefaultValues.kt") + public void testParametersWithDefaultValues() throws Exception { + runTest("plugins/uast-kotlin/testData/ParametersWithDefaultValues.kt"); + } + + @TestMetadata("PropertyAccessors.kt") + public void testPropertyAccessors() throws Exception { + runTest("plugins/uast-kotlin/testData/PropertyAccessors.kt"); + } + + @TestMetadata("PropertyDelegate.kt") + public void testPropertyDelegate() throws Exception { + runTest("plugins/uast-kotlin/testData/PropertyDelegate.kt"); + } + + @TestMetadata("PropertyInitializer.kt") + public void testPropertyInitializer() throws Exception { + runTest("plugins/uast-kotlin/testData/PropertyInitializer.kt"); + } + + @TestMetadata("PropertyInitializerWithoutSetter.kt") + public void testPropertyInitializerWithoutSetter() throws Exception { + runTest("plugins/uast-kotlin/testData/PropertyInitializerWithoutSetter.kt"); + } + + @TestMetadata("PropertyReferences.kt") + public void testPropertyReferences() throws Exception { + runTest("plugins/uast-kotlin/testData/PropertyReferences.kt"); + } + + @TestMetadata("PropertyWithAnnotation.kt") + public void testPropertyWithAnnotation() throws Exception { + runTest("plugins/uast-kotlin/testData/PropertyWithAnnotation.kt"); + } + + @TestMetadata("QualifiedConstructorCall.kt") + public void testQualifiedConstructorCall() throws Exception { + runTest("plugins/uast-kotlin/testData/QualifiedConstructorCall.kt"); + } + + @TestMetadata("ReceiverFun.kt") + public void testReceiverFun() throws Exception { + runTest("plugins/uast-kotlin/testData/ReceiverFun.kt"); + } + + @TestMetadata("Reified.kt") + public void testReified() throws Exception { + runTest("plugins/uast-kotlin/testData/Reified.kt"); + } + + @TestMetadata("ReifiedParameters.kt") + public void testReifiedParameters() throws Exception { + runTest("plugins/uast-kotlin/testData/ReifiedParameters.kt"); + } + + @TestMetadata("ReifiedResolve.kt") + public void testReifiedResolve() throws Exception { + runTest("plugins/uast-kotlin/testData/ReifiedResolve.kt"); + } + + @TestMetadata("ReifiedReturnType.kt") + public void testReifiedReturnType() throws Exception { + runTest("plugins/uast-kotlin/testData/ReifiedReturnType.kt"); + } + + @TestMetadata("Resolve.kt") + public void testResolve() throws Exception { + runTest("plugins/uast-kotlin/testData/Resolve.kt"); + } + + @TestMetadata("SAM.kt") + public void testSAM() throws Exception { + runTest("plugins/uast-kotlin/testData/SAM.kt"); + } + + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("plugins/uast-kotlin/testData/Simple.kt"); + } + + @TestMetadata("SimpleAnnotated.kt") + public void testSimpleAnnotated() throws Exception { + runTest("plugins/uast-kotlin/testData/SimpleAnnotated.kt"); + } + + @TestMetadata("StringTemplate.kt") + public void testStringTemplate() throws Exception { + runTest("plugins/uast-kotlin/testData/StringTemplate.kt"); + } + + @TestMetadata("StringTemplateComplex.kt") + public void testStringTemplateComplex() throws Exception { + runTest("plugins/uast-kotlin/testData/StringTemplateComplex.kt"); + } + + @TestMetadata("StringTemplateComplexForUInjectionHost.kt") + public void testStringTemplateComplexForUInjectionHost() throws Exception { + runTest("plugins/uast-kotlin/testData/StringTemplateComplexForUInjectionHost.kt"); + } + + @TestMetadata("StringTemplateInClass.kt") + public void testStringTemplateInClass() throws Exception { + runTest("plugins/uast-kotlin/testData/StringTemplateInClass.kt"); + } + + @TestMetadata("StringTemplateWithVar.kt") + public void testStringTemplateWithVar() throws Exception { + runTest("plugins/uast-kotlin/testData/StringTemplateWithVar.kt"); + } + + @TestMetadata("SuperCalls.kt") + public void testSuperCalls() throws Exception { + runTest("plugins/uast-kotlin/testData/SuperCalls.kt"); + } + + @TestMetadata("Suspend.kt") + public void testSuspend() throws Exception { + runTest("plugins/uast-kotlin/testData/Suspend.kt"); + } + + @TestMetadata("TryCatch.kt") + public void testTryCatch() throws Exception { + runTest("plugins/uast-kotlin/testData/TryCatch.kt"); + } + + @TestMetadata("TypeAliasExpansionWithOtherAliasInArgument.kt") + public void testTypeAliasExpansionWithOtherAliasInArgument() throws Exception { + runTest("plugins/uast-kotlin/testData/TypeAliasExpansionWithOtherAliasInArgument.kt"); + } + + @TestMetadata("TypeAliases.kt") + public void testTypeAliases() throws Exception { + runTest("plugins/uast-kotlin/testData/TypeAliases.kt"); + } + + @TestMetadata("TypeInAnnotation.kt") + public void testTypeInAnnotation() throws Exception { + runTest("plugins/uast-kotlin/testData/TypeInAnnotation.kt"); + } + + @TestMetadata("TypeReferences.kt") + public void testTypeReferences() throws Exception { + runTest("plugins/uast-kotlin/testData/TypeReferences.kt"); + } + + @TestMetadata("UnexpectedContainerException.kt") + public void testUnexpectedContainerException() throws Exception { + runTest("plugins/uast-kotlin/testData/UnexpectedContainerException.kt"); + } + + @TestMetadata("WhenAndDestructing.kt") + public void testWhenAndDestructing() throws Exception { + runTest("plugins/uast-kotlin/testData/WhenAndDestructing.kt"); + } + + @TestMetadata("WhenIs.kt") + public void testWhenIs() throws Exception { + runTest("plugins/uast-kotlin/testData/WhenIs.kt"); + } + + @TestMetadata("WhenStringLiteral.kt") + public void testWhenStringLiteral() throws Exception { + runTest("plugins/uast-kotlin/testData/WhenStringLiteral.kt"); + } +} diff --git a/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FE1UastDeclarationTestGenerated.java b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FE1UastDeclarationTestGenerated.java index 1d47c1c94f0..ea37c145baf 100644 --- a/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FE1UastDeclarationTestGenerated.java +++ b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FE1UastDeclarationTestGenerated.java @@ -17,71 +17,30 @@ import java.util.regex.Pattern; /** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") +@TestMetadata("plugins/uast-kotlin-fir/testData/declaration") +@TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public class FE1UastDeclarationTestGenerated extends AbstractFE1UastDeclarationTest { - @TestMetadata("plugins/uast-kotlin-fir/testData/declaration") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Declaration extends AbstractFE1UastDeclarationTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInDeclaration() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/uast-kotlin-fir/testData/declaration"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @TestMetadata("facade.kt") - public void testFacade() throws Exception { - runTest("plugins/uast-kotlin-fir/testData/declaration/facade.kt"); - } - - @TestMetadata("importOnDemand.kt") - public void testImportOnDemand() throws Exception { - runTest("plugins/uast-kotlin-fir/testData/declaration/importOnDemand.kt"); - } - - @TestMetadata("objects.kt") - public void testObjects() throws Exception { - runTest("plugins/uast-kotlin-fir/testData/declaration/objects.kt"); - } + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - @TestMetadata("plugins/uast-kotlin-fir/testData/legacy") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Legacy extends AbstractFE1UastDeclarationTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } + public void testAllFilesPresentInDeclaration() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/uast-kotlin-fir/testData/declaration"), Pattern.compile("^(.+)\\.kt$"), null, true); + } - public void testAllFilesPresentInLegacy() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/uast-kotlin-fir/testData/legacy"), Pattern.compile("^(.+)\\.kt$"), null, true); - } + @TestMetadata("facade.kt") + public void testFacade() throws Exception { + runTest("plugins/uast-kotlin-fir/testData/declaration/facade.kt"); + } - @TestMetadata("Constructors.kt") - public void testConstructors() throws Exception { - runTest("plugins/uast-kotlin-fir/testData/legacy/Constructors.kt"); - } + @TestMetadata("importOnDemand.kt") + public void testImportOnDemand() throws Exception { + runTest("plugins/uast-kotlin-fir/testData/declaration/importOnDemand.kt"); + } - @TestMetadata("Imports.kt") - public void testImports() throws Exception { - runTest("plugins/uast-kotlin-fir/testData/legacy/Imports.kt"); - } - - @TestMetadata("PropertyAccessors.kt") - public void testPropertyAccessors() throws Exception { - runTest("plugins/uast-kotlin-fir/testData/legacy/PropertyAccessors.kt"); - } - - @TestMetadata("PropertyInitializer.kt") - public void testPropertyInitializer() throws Exception { - runTest("plugins/uast-kotlin-fir/testData/legacy/PropertyInitializer.kt"); - } - - @TestMetadata("Simple.kt") - public void testSimple() throws Exception { - runTest("plugins/uast-kotlin-fir/testData/legacy/Simple.kt"); - } + @TestMetadata("objects.kt") + public void testObjects() throws Exception { + runTest("plugins/uast-kotlin-fir/testData/declaration/objects.kt"); } } diff --git a/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FirLegacyUastDeclarationTestGenerated.java b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FirLegacyUastDeclarationTestGenerated.java new file mode 100644 index 00000000000..5fe214a1c5b --- /dev/null +++ b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FirLegacyUastDeclarationTestGenerated.java @@ -0,0 +1,381 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.uast.test.kotlin; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.util.KtTestUtil; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("plugins/uast-kotlin/testData") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class FirLegacyUastDeclarationTestGenerated extends AbstractFirLegacyUastDeclarationTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInTestData() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/uast-kotlin/testData"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("AnnotatedExpressions.kt") + public void testAnnotatedExpressions() throws Exception { + runTest("plugins/uast-kotlin/testData/AnnotatedExpressions.kt"); + } + + @TestMetadata("AnnotationComplex.kt") + public void testAnnotationComplex() throws Exception { + runTest("plugins/uast-kotlin/testData/AnnotationComplex.kt"); + } + + @TestMetadata("AnnotationParameters.kt") + public void testAnnotationParameters() throws Exception { + runTest("plugins/uast-kotlin/testData/AnnotationParameters.kt"); + } + + @TestMetadata("Anonymous.kt") + public void testAnonymous() throws Exception { + runTest("plugins/uast-kotlin/testData/Anonymous.kt"); + } + + @TestMetadata("Assertion.kt") + public void testAssertion() throws Exception { + runTest("plugins/uast-kotlin/testData/Assertion.kt"); + } + + @TestMetadata("Bitwise.kt") + public void testBitwise() throws Exception { + runTest("plugins/uast-kotlin/testData/Bitwise.kt"); + } + + @TestMetadata("BrokenMethod.kt") + public void testBrokenMethod() throws Exception { + runTest("plugins/uast-kotlin/testData/BrokenMethod.kt"); + } + + @TestMetadata("ClassAnnotation.kt") + public void testClassAnnotation() throws Exception { + runTest("plugins/uast-kotlin/testData/ClassAnnotation.kt"); + } + + @TestMetadata("ConstructorDelegate.kt") + public void testConstructorDelegate() throws Exception { + runTest("plugins/uast-kotlin/testData/ConstructorDelegate.kt"); + } + + @TestMetadata("Constructors.kt") + public void testConstructors() throws Exception { + runTest("plugins/uast-kotlin/testData/Constructors.kt"); + } + + @TestMetadata("CycleInTypeParameters.kt") + public void testCycleInTypeParameters() throws Exception { + runTest("plugins/uast-kotlin/testData/CycleInTypeParameters.kt"); + } + + @TestMetadata("DefaultImpls.kt") + public void testDefaultImpls() throws Exception { + runTest("plugins/uast-kotlin/testData/DefaultImpls.kt"); + } + + @TestMetadata("DefaultParameterValues.kt") + public void testDefaultParameterValues() throws Exception { + runTest("plugins/uast-kotlin/testData/DefaultParameterValues.kt"); + } + + @TestMetadata("Delegate.kt") + public void testDelegate() throws Exception { + runTest("plugins/uast-kotlin/testData/Delegate.kt"); + } + + @TestMetadata("DeprecatedHidden.kt") + public void testDeprecatedHidden() throws Exception { + runTest("plugins/uast-kotlin/testData/DeprecatedHidden.kt"); + } + + @TestMetadata("DestructuringDeclaration.kt") + public void testDestructuringDeclaration() throws Exception { + runTest("plugins/uast-kotlin/testData/DestructuringDeclaration.kt"); + } + + @TestMetadata("ea101715.kt") + public void testEa101715() throws Exception { + runTest("plugins/uast-kotlin/testData/ea101715.kt"); + } + + @TestMetadata("Elvis.kt") + public void testElvis() throws Exception { + runTest("plugins/uast-kotlin/testData/Elvis.kt"); + } + + @TestMetadata("ElvisType.kt") + public void testElvisType() throws Exception { + runTest("plugins/uast-kotlin/testData/ElvisType.kt"); + } + + @TestMetadata("EnumValueMembers.kt") + public void testEnumValueMembers() throws Exception { + runTest("plugins/uast-kotlin/testData/EnumValueMembers.kt"); + } + + @TestMetadata("EnumValuesConstructors.kt") + public void testEnumValuesConstructors() throws Exception { + runTest("plugins/uast-kotlin/testData/EnumValuesConstructors.kt"); + } + + @TestMetadata("IfStatement.kt") + public void testIfStatement() throws Exception { + runTest("plugins/uast-kotlin/testData/IfStatement.kt"); + } + + @TestMetadata("Imports.kt") + public void testImports() throws Exception { + runTest("plugins/uast-kotlin/testData/Imports.kt"); + } + + @TestMetadata("In.kt") + public void testIn() throws Exception { + runTest("plugins/uast-kotlin/testData/In.kt"); + } + + @TestMetadata("InferenceInsideUnresolvedConstructor.kt") + public void testInferenceInsideUnresolvedConstructor() throws Exception { + runTest("plugins/uast-kotlin/testData/InferenceInsideUnresolvedConstructor.kt"); + } + + @TestMetadata("InnerClasses.kt") + public void testInnerClasses() throws Exception { + runTest("plugins/uast-kotlin/testData/InnerClasses.kt"); + } + + @TestMetadata("InnerNonFixedTypeVariable.kt") + public void testInnerNonFixedTypeVariable() throws Exception { + runTest("plugins/uast-kotlin/testData/InnerNonFixedTypeVariable.kt"); + } + + @TestMetadata("LambdaReturn.kt") + public void testLambdaReturn() throws Exception { + runTest("plugins/uast-kotlin/testData/LambdaReturn.kt"); + } + + @TestMetadata("Lambdas.kt") + public void testLambdas() throws Exception { + runTest("plugins/uast-kotlin/testData/Lambdas.kt"); + } + + @TestMetadata("LocalDeclarations.kt") + public void testLocalDeclarations() throws Exception { + runTest("plugins/uast-kotlin/testData/LocalDeclarations.kt"); + } + + @TestMetadata("LocalVariableWithAnnotation.kt") + public void testLocalVariableWithAnnotation() throws Exception { + runTest("plugins/uast-kotlin/testData/LocalVariableWithAnnotation.kt"); + } + + @TestMetadata("ManyAlternatives.kt") + public void testManyAlternatives() throws Exception { + runTest("plugins/uast-kotlin/testData/ManyAlternatives.kt"); + } + + @TestMetadata("MethodReference.kt") + public void testMethodReference() throws Exception { + runTest("plugins/uast-kotlin/testData/MethodReference.kt"); + } + + @TestMetadata("NameContainingFile.kt") + public void testNameContainingFile() throws Exception { + runTest("plugins/uast-kotlin/testData/NameContainingFile.kt"); + } + + @TestMetadata("NonTrivialIdentifiers.kt") + public void testNonTrivialIdentifiers() throws Exception { + runTest("plugins/uast-kotlin/testData/NonTrivialIdentifiers.kt"); + } + + @TestMetadata("ParameterPropertyWithAnnotation.kt") + public void testParameterPropertyWithAnnotation() throws Exception { + runTest("plugins/uast-kotlin/testData/ParameterPropertyWithAnnotation.kt"); + } + + @TestMetadata("ParametersDisorder.kt") + public void testParametersDisorder() throws Exception { + runTest("plugins/uast-kotlin/testData/ParametersDisorder.kt"); + } + + @TestMetadata("ParametersWithDefaultValues.kt") + public void testParametersWithDefaultValues() throws Exception { + runTest("plugins/uast-kotlin/testData/ParametersWithDefaultValues.kt"); + } + + @TestMetadata("PropertyAccessors.kt") + public void testPropertyAccessors() throws Exception { + runTest("plugins/uast-kotlin/testData/PropertyAccessors.kt"); + } + + @TestMetadata("PropertyDelegate.kt") + public void testPropertyDelegate() throws Exception { + runTest("plugins/uast-kotlin/testData/PropertyDelegate.kt"); + } + + @TestMetadata("PropertyInitializer.kt") + public void testPropertyInitializer() throws Exception { + runTest("plugins/uast-kotlin/testData/PropertyInitializer.kt"); + } + + @TestMetadata("PropertyInitializerWithoutSetter.kt") + public void testPropertyInitializerWithoutSetter() throws Exception { + runTest("plugins/uast-kotlin/testData/PropertyInitializerWithoutSetter.kt"); + } + + @TestMetadata("PropertyReferences.kt") + public void testPropertyReferences() throws Exception { + runTest("plugins/uast-kotlin/testData/PropertyReferences.kt"); + } + + @TestMetadata("PropertyWithAnnotation.kt") + public void testPropertyWithAnnotation() throws Exception { + runTest("plugins/uast-kotlin/testData/PropertyWithAnnotation.kt"); + } + + @TestMetadata("QualifiedConstructorCall.kt") + public void testQualifiedConstructorCall() throws Exception { + runTest("plugins/uast-kotlin/testData/QualifiedConstructorCall.kt"); + } + + @TestMetadata("ReceiverFun.kt") + public void testReceiverFun() throws Exception { + runTest("plugins/uast-kotlin/testData/ReceiverFun.kt"); + } + + @TestMetadata("Reified.kt") + public void testReified() throws Exception { + runTest("plugins/uast-kotlin/testData/Reified.kt"); + } + + @TestMetadata("ReifiedParameters.kt") + public void testReifiedParameters() throws Exception { + runTest("plugins/uast-kotlin/testData/ReifiedParameters.kt"); + } + + @TestMetadata("ReifiedResolve.kt") + public void testReifiedResolve() throws Exception { + runTest("plugins/uast-kotlin/testData/ReifiedResolve.kt"); + } + + @TestMetadata("ReifiedReturnType.kt") + public void testReifiedReturnType() throws Exception { + runTest("plugins/uast-kotlin/testData/ReifiedReturnType.kt"); + } + + @TestMetadata("Resolve.kt") + public void testResolve() throws Exception { + runTest("plugins/uast-kotlin/testData/Resolve.kt"); + } + + @TestMetadata("SAM.kt") + public void testSAM() throws Exception { + runTest("plugins/uast-kotlin/testData/SAM.kt"); + } + + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + runTest("plugins/uast-kotlin/testData/Simple.kt"); + } + + @TestMetadata("SimpleAnnotated.kt") + public void testSimpleAnnotated() throws Exception { + runTest("plugins/uast-kotlin/testData/SimpleAnnotated.kt"); + } + + @TestMetadata("StringTemplate.kt") + public void testStringTemplate() throws Exception { + runTest("plugins/uast-kotlin/testData/StringTemplate.kt"); + } + + @TestMetadata("StringTemplateComplex.kt") + public void testStringTemplateComplex() throws Exception { + runTest("plugins/uast-kotlin/testData/StringTemplateComplex.kt"); + } + + @TestMetadata("StringTemplateComplexForUInjectionHost.kt") + public void testStringTemplateComplexForUInjectionHost() throws Exception { + runTest("plugins/uast-kotlin/testData/StringTemplateComplexForUInjectionHost.kt"); + } + + @TestMetadata("StringTemplateInClass.kt") + public void testStringTemplateInClass() throws Exception { + runTest("plugins/uast-kotlin/testData/StringTemplateInClass.kt"); + } + + @TestMetadata("StringTemplateWithVar.kt") + public void testStringTemplateWithVar() throws Exception { + runTest("plugins/uast-kotlin/testData/StringTemplateWithVar.kt"); + } + + @TestMetadata("SuperCalls.kt") + public void testSuperCalls() throws Exception { + runTest("plugins/uast-kotlin/testData/SuperCalls.kt"); + } + + @TestMetadata("Suspend.kt") + public void testSuspend() throws Exception { + runTest("plugins/uast-kotlin/testData/Suspend.kt"); + } + + @TestMetadata("TryCatch.kt") + public void testTryCatch() throws Exception { + runTest("plugins/uast-kotlin/testData/TryCatch.kt"); + } + + @TestMetadata("TypeAliasExpansionWithOtherAliasInArgument.kt") + public void testTypeAliasExpansionWithOtherAliasInArgument() throws Exception { + runTest("plugins/uast-kotlin/testData/TypeAliasExpansionWithOtherAliasInArgument.kt"); + } + + @TestMetadata("TypeAliases.kt") + public void testTypeAliases() throws Exception { + runTest("plugins/uast-kotlin/testData/TypeAliases.kt"); + } + + @TestMetadata("TypeInAnnotation.kt") + public void testTypeInAnnotation() throws Exception { + runTest("plugins/uast-kotlin/testData/TypeInAnnotation.kt"); + } + + @TestMetadata("TypeReferences.kt") + public void testTypeReferences() throws Exception { + runTest("plugins/uast-kotlin/testData/TypeReferences.kt"); + } + + @TestMetadata("UnexpectedContainerException.kt") + public void testUnexpectedContainerException() throws Exception { + runTest("plugins/uast-kotlin/testData/UnexpectedContainerException.kt"); + } + + @TestMetadata("WhenAndDestructing.kt") + public void testWhenAndDestructing() throws Exception { + runTest("plugins/uast-kotlin/testData/WhenAndDestructing.kt"); + } + + @TestMetadata("WhenIs.kt") + public void testWhenIs() throws Exception { + runTest("plugins/uast-kotlin/testData/WhenIs.kt"); + } + + @TestMetadata("WhenStringLiteral.kt") + public void testWhenStringLiteral() throws Exception { + runTest("plugins/uast-kotlin/testData/WhenStringLiteral.kt"); + } +} diff --git a/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FirUastDeclarationTestGenerated.java b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FirUastDeclarationTestGenerated.java index 765717d9afe..904557eb955 100644 --- a/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FirUastDeclarationTestGenerated.java +++ b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FirUastDeclarationTestGenerated.java @@ -17,71 +17,30 @@ import java.util.regex.Pattern; /** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") +@TestMetadata("plugins/uast-kotlin-fir/testData/declaration") +@TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public class FirUastDeclarationTestGenerated extends AbstractFirUastDeclarationTest { - @TestMetadata("plugins/uast-kotlin-fir/testData/declaration") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Declaration extends AbstractFirUastDeclarationTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInDeclaration() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/uast-kotlin-fir/testData/declaration"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @TestMetadata("facade.kt") - public void testFacade() throws Exception { - runTest("plugins/uast-kotlin-fir/testData/declaration/facade.kt"); - } - - @TestMetadata("importOnDemand.kt") - public void testImportOnDemand() throws Exception { - runTest("plugins/uast-kotlin-fir/testData/declaration/importOnDemand.kt"); - } - - @TestMetadata("objects.kt") - public void testObjects() throws Exception { - runTest("plugins/uast-kotlin-fir/testData/declaration/objects.kt"); - } + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - @TestMetadata("plugins/uast-kotlin-fir/testData/legacy") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Legacy extends AbstractFirUastDeclarationTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } + public void testAllFilesPresentInDeclaration() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/uast-kotlin-fir/testData/declaration"), Pattern.compile("^(.+)\\.kt$"), null, true); + } - public void testAllFilesPresentInLegacy() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/uast-kotlin-fir/testData/legacy"), Pattern.compile("^(.+)\\.kt$"), null, true); - } + @TestMetadata("facade.kt") + public void testFacade() throws Exception { + runTest("plugins/uast-kotlin-fir/testData/declaration/facade.kt"); + } - @TestMetadata("Constructors.kt") - public void testConstructors() throws Exception { - runTest("plugins/uast-kotlin-fir/testData/legacy/Constructors.kt"); - } + @TestMetadata("importOnDemand.kt") + public void testImportOnDemand() throws Exception { + runTest("plugins/uast-kotlin-fir/testData/declaration/importOnDemand.kt"); + } - @TestMetadata("Imports.kt") - public void testImports() throws Exception { - runTest("plugins/uast-kotlin-fir/testData/legacy/Imports.kt"); - } - - @TestMetadata("PropertyAccessors.kt") - public void testPropertyAccessors() throws Exception { - runTest("plugins/uast-kotlin-fir/testData/legacy/PropertyAccessors.kt"); - } - - @TestMetadata("PropertyInitializer.kt") - public void testPropertyInitializer() throws Exception { - runTest("plugins/uast-kotlin-fir/testData/legacy/PropertyInitializer.kt"); - } - - @TestMetadata("Simple.kt") - public void testSimple() throws Exception { - runTest("plugins/uast-kotlin-fir/testData/legacy/Simple.kt"); - } + @TestMetadata("objects.kt") + public void testObjects() throws Exception { + runTest("plugins/uast-kotlin-fir/testData/declaration/objects.kt"); } } diff --git a/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FirUastResolveApiTest.kt b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FirUastResolveApiTest.kt index 299a25942dc..618fc23c008 100644 --- a/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FirUastResolveApiTest.kt +++ b/plugins/uast-kotlin-fir/tests/org/jetbrains/uast/test/kotlin/FirUastResolveApiTest.kt @@ -27,7 +27,7 @@ class FirUastResolveApiTest : AbstractFirUastTest() { // Bogus } - @TestMetadata("plugins/uast-kotlin-fir/testData/legacy") + @TestMetadata("plugins/uast-kotlin/testData") @TestDataPath("\$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners::class) class Legacy : AbstractFirUastTest() { @@ -39,7 +39,7 @@ class FirUastResolveApiTest : AbstractFirUastTest() { @TestMetadata("Imports.kt") fun testImports() { - doCheck("plugins/uast-kotlin-fir/testData/legacy/Imports.kt") { _, uFile -> + doCheck("plugins/uast-kotlin/testData/Imports.kt") { _, uFile -> uFile.imports.forEach { uImport -> val resolvedImport = uImport.resolve() ?: throw IllegalStateException("Unresolved import: ${uImport.asRenderString()}") diff --git a/plugins/uast-kotlin/testData/AnnotatedExpressions.kt b/plugins/uast-kotlin/testData/AnnotatedExpressions.kt index c2a7655c9b2..d5bbc9ed5a8 100644 --- a/plugins/uast-kotlin/testData/AnnotatedExpressions.kt +++ b/plugins/uast-kotlin/testData/AnnotatedExpressions.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + fun foo() { @Suppress @@ -28,4 +30,4 @@ fun annotatedSwitch(str: String) = str.isBlank() -> null str.isNotEmpty() != null -> null else -> 1 - } \ No newline at end of file + } diff --git a/plugins/uast-kotlin/testData/AnnotationComplex.kt b/plugins/uast-kotlin/testData/AnnotationComplex.kt index 1e841586f95..ca8aed04857 100644 --- a/plugins/uast-kotlin/testData/AnnotationComplex.kt +++ b/plugins/uast-kotlin/testData/AnnotationComplex.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + annotation class Annotation(vararg val strings: String) @Annotation @@ -17,4 +19,4 @@ annotation class AnnotationArray(vararg val value: Annotation) class C @AnnotationArray(Annotation(strings = ["[sar]1", "[sar]2"])) -class C2 \ No newline at end of file +class C2 diff --git a/plugins/uast-kotlin/testData/AnnotationParameters.kt b/plugins/uast-kotlin/testData/AnnotationParameters.kt index f4a2d735052..7aab2faee32 100644 --- a/plugins/uast-kotlin/testData/AnnotationParameters.kt +++ b/plugins/uast-kotlin/testData/AnnotationParameters.kt @@ -1,3 +1,4 @@ +// !IGNORE_FIR annotation class IntRange(val from: Long, val to: Long) @@ -23,4 +24,4 @@ fun bar() = Unit fun fooWithArrLiteral(): Int = 5 @RequiresStrPermission(strs = ["a", "b", "c"]) -fun fooWithStrArrLiteral(): Int = 3 \ No newline at end of file +fun fooWithStrArrLiteral(): Int = 3 diff --git a/plugins/uast-kotlin/testData/Anonymous.kt b/plugins/uast-kotlin/testData/Anonymous.kt index 349124b5b5e..f7e35511711 100644 --- a/plugins/uast-kotlin/testData/Anonymous.kt +++ b/plugins/uast-kotlin/testData/Anonymous.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + import java.io.Closeable import java.io.InputStream @@ -13,4 +15,4 @@ fun foo() { fun withErr() { val runnable = object Runnable {} // EA-122644 -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/Assertion.kt b/plugins/uast-kotlin/testData/Assertion.kt index 245dda65115..ba219d872f7 100644 --- a/plugins/uast-kotlin/testData/Assertion.kt +++ b/plugins/uast-kotlin/testData/Assertion.kt @@ -1,4 +1,6 @@ +// !IGNORE_FIR + fun foo(): String { val s: String? = "Not Null" return s!! -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/Bitwise.kt b/plugins/uast-kotlin/testData/Bitwise.kt index 1b0b94f2d39..ee0ba92cafc 100644 --- a/plugins/uast-kotlin/testData/Bitwise.kt +++ b/plugins/uast-kotlin/testData/Bitwise.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + fun foo(): Int { val mask: Int = 0x7f val x: Int = 0b1010_1010_1010_1010_1010_1010_1010_1010 diff --git a/plugins/uast-kotlin/testData/BrokenMethod.kt b/plugins/uast-kotlin/testData/BrokenMethod.kt index df962fed1bb..b403f15d8d9 100644 --- a/plugins/uast-kotlin/testData/BrokenMethod.kt +++ b/plugins/uast-kotlin/testData/BrokenMethod.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + fun main(args: Array) { // Error data class TestUsed(val parameter: CharSequence) { @@ -7,4 +9,4 @@ fun main(args: Array) { // Error } } } -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/ClassAnnotation.kt b/plugins/uast-kotlin/testData/ClassAnnotation.kt index 4ae0a54917e..e78505ac7f6 100644 --- a/plugins/uast-kotlin/testData/ClassAnnotation.kt +++ b/plugins/uast-kotlin/testData/ClassAnnotation.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + @Test class A @@ -19,4 +21,4 @@ class B { } @MyAnnotation("object") -object Obj \ No newline at end of file +object Obj diff --git a/plugins/uast-kotlin/testData/ConstructorDelegate.kt b/plugins/uast-kotlin/testData/ConstructorDelegate.kt index 3da6ec1a8c2..2c7a03926a7 100644 --- a/plugins/uast-kotlin/testData/ConstructorDelegate.kt +++ b/plugins/uast-kotlin/testData/ConstructorDelegate.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + interface Base { fun print() } @@ -12,4 +14,4 @@ class Derived(b: Base) : Base by createBase(10), CharSequence by "abc" fun createBase(i: Int): Base { return BaseImpl(i) -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/CycleInTypeParameters.kt b/plugins/uast-kotlin/testData/CycleInTypeParameters.kt index 89e7ce61dd1..3242495cd21 100644 --- a/plugins/uast-kotlin/testData/CycleInTypeParameters.kt +++ b/plugins/uast-kotlin/testData/CycleInTypeParameters.kt @@ -1,3 +1,4 @@ +// !IGNORE_FIR class Device> diff --git a/plugins/uast-kotlin/testData/DefaultImpls.kt b/plugins/uast-kotlin/testData/DefaultImpls.kt index 836eeff2f8c..308db0909fe 100644 --- a/plugins/uast-kotlin/testData/DefaultImpls.kt +++ b/plugins/uast-kotlin/testData/DefaultImpls.kt @@ -1,6 +1,7 @@ +// !IGNORE_FIR interface Foo { fun bar() = "Hello!" } -class Baz : Foo \ No newline at end of file +class Baz : Foo diff --git a/plugins/uast-kotlin/testData/DefaultParameterValues.kt b/plugins/uast-kotlin/testData/DefaultParameterValues.kt index cf492da2b18..b86ecb28862 100644 --- a/plugins/uast-kotlin/testData/DefaultParameterValues.kt +++ b/plugins/uast-kotlin/testData/DefaultParameterValues.kt @@ -1,2 +1,4 @@ +// !IGNORE_FIR + fun foo(a: Int = 1, foo: String? = null) { -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/Delegate.kt b/plugins/uast-kotlin/testData/Delegate.kt index 1281a12210b..632f43aa8ff 100644 --- a/plugins/uast-kotlin/testData/Delegate.kt +++ b/plugins/uast-kotlin/testData/Delegate.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + class MyColor(val x: Int, val y: Int, val z: Int) class Some { @@ -6,4 +8,4 @@ class Some { val lambda = lazy { MyColor(1, 2, 3) } val nonLazy = MyColor(1, 2, 3) -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/DeprecatedHidden.kt b/plugins/uast-kotlin/testData/DeprecatedHidden.kt index 0d4798dd4c6..aa0774eb279 100644 --- a/plugins/uast-kotlin/testData/DeprecatedHidden.kt +++ b/plugins/uast-kotlin/testData/DeprecatedHidden.kt @@ -1,7 +1,9 @@ +// !IGNORE_FIR + package test.pkg class Test { fun test1() { } @Deprecated(level = DeprecationLevel.HIDDEN, message="nothing") fun test2() { } -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/DestructuringDeclaration.kt b/plugins/uast-kotlin/testData/DestructuringDeclaration.kt index 299c4bcb4e1..4f5745d8765 100644 --- a/plugins/uast-kotlin/testData/DestructuringDeclaration.kt +++ b/plugins/uast-kotlin/testData/DestructuringDeclaration.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + fun foo(data: Any) { val (a, b) = "foo" to 1 diff --git a/plugins/uast-kotlin/testData/Elvis.kt b/plugins/uast-kotlin/testData/Elvis.kt index 17c55b2ec7f..eeb515deff4 100644 --- a/plugins/uast-kotlin/testData/Elvis.kt +++ b/plugins/uast-kotlin/testData/Elvis.kt @@ -1,3 +1,4 @@ +// !IGNORE_FIR fun foo(bar: String): String? = null @@ -5,4 +6,4 @@ fun bar() = 42 fun baz(): String? { return foo("Lorem ipsum") ?: foo("dolor sit amet") ?: bar().toString() -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/ElvisType.kt b/plugins/uast-kotlin/testData/ElvisType.kt index eb4a6ffc15e..25f168527d5 100644 --- a/plugins/uast-kotlin/testData/ElvisType.kt +++ b/plugins/uast-kotlin/testData/ElvisType.kt @@ -1,3 +1,4 @@ +// !IGNORE_FIR fun foo(text: String?) = bar(text ?: return) diff --git a/plugins/uast-kotlin/testData/EnumValueMembers.kt b/plugins/uast-kotlin/testData/EnumValueMembers.kt index 6611ec2e9fa..6fb29341bf9 100644 --- a/plugins/uast-kotlin/testData/EnumValueMembers.kt +++ b/plugins/uast-kotlin/testData/EnumValueMembers.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + enum class Style(val value: String) { SHEET("foo") { override val exitAnimation: String @@ -5,4 +7,4 @@ enum class Style(val value: String) { }; abstract val exitAnimation: String -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/EnumValuesConstructors.kt b/plugins/uast-kotlin/testData/EnumValuesConstructors.kt index f7198ca4082..112be0125e3 100644 --- a/plugins/uast-kotlin/testData/EnumValuesConstructors.kt +++ b/plugins/uast-kotlin/testData/EnumValuesConstructors.kt @@ -1,6 +1,8 @@ +// !IGNORE_FIR + enum class Style(val value: String?) { SYSTEM("system"), USER("user"), INTERNAL("internal"), UNKNOWN(null); -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/IfStatement.kt b/plugins/uast-kotlin/testData/IfStatement.kt index 9a19fa3410c..ba7a84d068d 100644 --- a/plugins/uast-kotlin/testData/IfStatement.kt +++ b/plugins/uast-kotlin/testData/IfStatement.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + fun foo() { val x = if ("abc" != "def") 1 else 0 } diff --git a/plugins/uast-kotlin/testData/In.kt b/plugins/uast-kotlin/testData/In.kt index d7a5641b705..4c0533518a1 100644 --- a/plugins/uast-kotlin/testData/In.kt +++ b/plugins/uast-kotlin/testData/In.kt @@ -1,5 +1,7 @@ +// !IGNORE_FIR + fun foo(): Boolean { val x = 1 val y = 10 return x in 0..5 && y !in 4..9 -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/InferenceInsideUnresolvedConstructor.kt b/plugins/uast-kotlin/testData/InferenceInsideUnresolvedConstructor.kt index 41277eeb27a..bf6667a4a5c 100644 --- a/plugins/uast-kotlin/testData/InferenceInsideUnresolvedConstructor.kt +++ b/plugins/uast-kotlin/testData/InferenceInsideUnresolvedConstructor.kt @@ -1,4 +1,6 @@ +// !IGNORE_FIR + val bar: Any get() = Unresolved(id(42)) -fun id(x: T): T = x \ No newline at end of file +fun id(x: T): T = x diff --git a/plugins/uast-kotlin/testData/InnerClasses.kt b/plugins/uast-kotlin/testData/InnerClasses.kt index 1c4bfe525fa..1cf7b8ea734 100644 --- a/plugins/uast-kotlin/testData/InnerClasses.kt +++ b/plugins/uast-kotlin/testData/InnerClasses.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + class Foo { class Bar(val a: Int, val b: Int) { fun getAPlusB() = a + b @@ -5,4 +7,4 @@ class Foo { fun doNothing() = Unit } } -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/InnerNonFixedTypeVariable.kt b/plugins/uast-kotlin/testData/InnerNonFixedTypeVariable.kt index ebd7a673ecd..024d5fae859 100644 --- a/plugins/uast-kotlin/testData/InnerNonFixedTypeVariable.kt +++ b/plugins/uast-kotlin/testData/InnerNonFixedTypeVariable.kt @@ -1,6 +1,8 @@ +// !IGNORE_FIR + class Some> fun test(list: List) { list.filterIsInstance().mapTo(mutableSetOf()) { } -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/LambdaReturn.kt b/plugins/uast-kotlin/testData/LambdaReturn.kt index 168252fe080..115d04021a6 100644 --- a/plugins/uast-kotlin/testData/LambdaReturn.kt +++ b/plugins/uast-kotlin/testData/LambdaReturn.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + package org.jetbrains.uast.kotlin fun foo() { @@ -49,4 +51,4 @@ fun foo() { private inline fun bar(lmbd: (Int) -> Int) { lmbd(1) -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/Lambdas.kt b/plugins/uast-kotlin/testData/Lambdas.kt index 44663e2ce57..c6cc529e435 100644 --- a/plugins/uast-kotlin/testData/Lambdas.kt +++ b/plugins/uast-kotlin/testData/Lambdas.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + import java.util.stream.Stream fun foo() { @@ -16,4 +18,4 @@ fun lambdaInPlaceCall() { while ({ true }()) { } -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/LocalDeclarations.kt b/plugins/uast-kotlin/testData/LocalDeclarations.kt index ff45265e296..5d68af5628c 100644 --- a/plugins/uast-kotlin/testData/LocalDeclarations.kt +++ b/plugins/uast-kotlin/testData/LocalDeclarations.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + fun foo(): Boolean { class Local fun bar() = Local() @@ -9,4 +11,4 @@ fun foo(): Boolean { fun Int.someLocalFun(text: String) = 42 return bar() == Local() -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/LocalVariableWithAnnotation.kt b/plugins/uast-kotlin/testData/LocalVariableWithAnnotation.kt index 91f36d09ada..40b707595a8 100644 --- a/plugins/uast-kotlin/testData/LocalVariableWithAnnotation.kt +++ b/plugins/uast-kotlin/testData/LocalVariableWithAnnotation.kt @@ -1,6 +1,8 @@ +// !IGNORE_FIR + annotation class TestAnnotation fun foo() { @TestAnnotation val bar = "lorem ipsum" -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/ManyAlternatives.kt b/plugins/uast-kotlin/testData/ManyAlternatives.kt index 2dcecd56d4e..4f24057f61a 100644 --- a/plugins/uast-kotlin/testData/ManyAlternatives.kt +++ b/plugins/uast-kotlin/testData/ManyAlternatives.kt @@ -1,5 +1,7 @@ +// !IGNORE_FIR + class ClassA(justParam: Int, val paramAndProp: String) { var writebleProp: Int = 0 -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/MethodReference.kt b/plugins/uast-kotlin/testData/MethodReference.kt index d9c52267a9e..25c0daa2d58 100644 --- a/plugins/uast-kotlin/testData/MethodReference.kt +++ b/plugins/uast-kotlin/testData/MethodReference.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + class Foo { fun bar() { } diff --git a/plugins/uast-kotlin/testData/NameContainingFile.kt b/plugins/uast-kotlin/testData/NameContainingFile.kt index bf1342100d7..9cd19bfd632 100644 --- a/plugins/uast-kotlin/testData/NameContainingFile.kt +++ b/plugins/uast-kotlin/testData/NameContainingFile.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + class Foo fun bar() {} diff --git a/plugins/uast-kotlin/testData/NonTrivialIdentifiers.kt b/plugins/uast-kotlin/testData/NonTrivialIdentifiers.kt index e67e145e5af..d2efa4a4d31 100644 --- a/plugins/uast-kotlin/testData/NonTrivialIdentifiers.kt +++ b/plugins/uast-kotlin/testData/NonTrivialIdentifiers.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + class A { operator fun invoke(){ @@ -18,4 +20,4 @@ fun main(a: A?){ A()() } } -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/ParameterPropertyWithAnnotation.kt b/plugins/uast-kotlin/testData/ParameterPropertyWithAnnotation.kt index 95cf4da360c..99e798a2793 100644 --- a/plugins/uast-kotlin/testData/ParameterPropertyWithAnnotation.kt +++ b/plugins/uast-kotlin/testData/ParameterPropertyWithAnnotation.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + annotation class MyAnnotation annotation class MyAnnotation2 annotation class MyAnnotation3 @@ -6,4 +8,4 @@ annotation class MyAnnotation5 class Test1(@MyAnnotation var bar: Int) -class Test2(@get:MyAnnotation @set:MyAnnotation2 @setparam:MyAnnotation3 @property:MyAnnotation4 @field:MyAnnotation5 var bar: Int) \ No newline at end of file +class Test2(@get:MyAnnotation @set:MyAnnotation2 @setparam:MyAnnotation3 @property:MyAnnotation4 @field:MyAnnotation5 var bar: Int) diff --git a/plugins/uast-kotlin/testData/ParametersDisorder.kt b/plugins/uast-kotlin/testData/ParametersDisorder.kt index 157a78223f5..bb0413d1070 100644 --- a/plugins/uast-kotlin/testData/ParametersDisorder.kt +++ b/plugins/uast-kotlin/testData/ParametersDisorder.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + fun global(a: Int, b: Float) {} fun withDefault(c: Int = 1, d: String = "aaa") {} @@ -32,4 +34,4 @@ open class Parent(a: String, b: Int) fun objectLiteral() { object : Parent(b = 1, a = "foo") { } -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/ParametersWithDefaultValues.kt b/plugins/uast-kotlin/testData/ParametersWithDefaultValues.kt index 531375e64fb..47cc4c72456 100644 --- a/plugins/uast-kotlin/testData/ParametersWithDefaultValues.kt +++ b/plugins/uast-kotlin/testData/ParametersWithDefaultValues.kt @@ -1,4 +1,5 @@ +// !IGNORE_FIR fun foo(a: Int, b: String, c: Int = 0, flag: Boolean = false) { -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/PropertyDelegate.kt b/plugins/uast-kotlin/testData/PropertyDelegate.kt index 1d019d904d6..b671ff8236e 100644 --- a/plugins/uast-kotlin/testData/PropertyDelegate.kt +++ b/plugins/uast-kotlin/testData/PropertyDelegate.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + val sdCardPath by lazy { "/sdcard" } fun localPropertyTest() { @@ -5,4 +7,4 @@ fun localPropertyTest() { } @delegate:Suppress -val annotatedDelegate by lazy { 1 + 1 } \ No newline at end of file +val annotatedDelegate by lazy { 1 + 1 } diff --git a/plugins/uast-kotlin/testData/PropertyInitializerWithoutSetter.kt b/plugins/uast-kotlin/testData/PropertyInitializerWithoutSetter.kt index aac1a6bbd4b..4f96db9ecea 100644 --- a/plugins/uast-kotlin/testData/PropertyInitializerWithoutSetter.kt +++ b/plugins/uast-kotlin/testData/PropertyInitializerWithoutSetter.kt @@ -1,3 +1,4 @@ +// !IGNORE_FIR var withoutSetter = "/sdcard" - get() = field \ No newline at end of file + get() = field diff --git a/plugins/uast-kotlin/testData/PropertyReferences.kt b/plugins/uast-kotlin/testData/PropertyReferences.kt index 08f3120b27c..5bc9b3ce4d1 100644 --- a/plugins/uast-kotlin/testData/PropertyReferences.kt +++ b/plugins/uast-kotlin/testData/PropertyReferences.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + class A(init: Int) { private var privateProp = 0 // accesses should be field accesses var mutableProp: Int diff --git a/plugins/uast-kotlin/testData/PropertyWithAnnotation.kt b/plugins/uast-kotlin/testData/PropertyWithAnnotation.kt index 854cd7ee550..c68f5305d45 100644 --- a/plugins/uast-kotlin/testData/PropertyWithAnnotation.kt +++ b/plugins/uast-kotlin/testData/PropertyWithAnnotation.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + annotation class TestAnnotation @TestAnnotation @@ -10,4 +12,4 @@ val prop2: Int @set:TestAnnotation var prop3: Int = 0 get() = 0 - set(value) { field = value } \ No newline at end of file + set(value) { field = value } diff --git a/plugins/uast-kotlin/testData/QualifiedConstructorCall.kt b/plugins/uast-kotlin/testData/QualifiedConstructorCall.kt index 362a4f3e308..f34948ebdfe 100644 --- a/plugins/uast-kotlin/testData/QualifiedConstructorCall.kt +++ b/plugins/uast-kotlin/testData/QualifiedConstructorCall.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + package A.B.C internal class Foo @@ -6,4 +8,4 @@ internal class Bar { fun getFoo(): Foo { return A.B.C.Foo() } -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/ReceiverFun.kt b/plugins/uast-kotlin/testData/ReceiverFun.kt index ea10d0cee5e..6ff0623423b 100644 --- a/plugins/uast-kotlin/testData/ReceiverFun.kt +++ b/plugins/uast-kotlin/testData/ReceiverFun.kt @@ -1,6 +1,8 @@ +// !IGNORE_FIR + annotation class MyReceiverAnnotation(val name: String = "") fun @receiver:MyReceiverAnnotation String.foo() = this.length val @receiver:MyReceiverAnnotation("RegExp") String.rx : Regex - get() { return toRegex() } \ No newline at end of file + get() { return toRegex() } diff --git a/plugins/uast-kotlin/testData/Reified.kt b/plugins/uast-kotlin/testData/Reified.kt index d73c0a998c4..0f1448e1d51 100644 --- a/plugins/uast-kotlin/testData/Reified.kt +++ b/plugins/uast-kotlin/testData/Reified.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + package test.pkg class Context { @@ -7,4 +9,4 @@ class Context { inline fun Context.systemService1() = getSystemService(T::class.java) -inline fun Context.systemService2() = getSystemService(String::class.java) \ No newline at end of file +inline fun Context.systemService2() = getSystemService(String::class.java) diff --git a/plugins/uast-kotlin/testData/ReifiedParameters.kt b/plugins/uast-kotlin/testData/ReifiedParameters.kt index 7c6f246cce7..464e02214b6 100644 --- a/plugins/uast-kotlin/testData/ReifiedParameters.kt +++ b/plugins/uast-kotlin/testData/ReifiedParameters.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + inline fun functionWithLambda(t: T, process: (T) -> Int): Int = process(t) inline fun functionWithVararg(i: Int?, vararg t: T): T = t[0] @@ -8,4 +10,4 @@ inline fun T.`name with spaces`(i: Int?): T = this inline fun functionWithParamAnnotation(@Suppress("s") t: T): T = t -inline fun functionUnresolved(@Suppress("s") t: Unresolved): T = t \ No newline at end of file +inline fun functionUnresolved(@Suppress("s") t: Unresolved): T = t diff --git a/plugins/uast-kotlin/testData/ReifiedResolve.kt b/plugins/uast-kotlin/testData/ReifiedResolve.kt index 651d78826e0..6ba3c3b5081 100644 --- a/plugins/uast-kotlin/testData/ReifiedResolve.kt +++ b/plugins/uast-kotlin/testData/ReifiedResolve.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + inline fun foo(init: T.() -> Unit = {}): T { TODO("message") } diff --git a/plugins/uast-kotlin/testData/ReifiedReturnType.kt b/plugins/uast-kotlin/testData/ReifiedReturnType.kt index 6b4842325fa..e1aeeda1958 100644 --- a/plugins/uast-kotlin/testData/ReifiedReturnType.kt +++ b/plugins/uast-kotlin/testData/ReifiedReturnType.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + inline fun function1(t: T, i: Int, s: String) {} inline fun function2(t: T, i: Int, s: String): T = t inline fun function2CharSequence(t: T, i: Int, s: String): T = t diff --git a/plugins/uast-kotlin/testData/Resolve.kt b/plugins/uast-kotlin/testData/Resolve.kt index bef7156561e..c3f6ab648ab 100644 --- a/plugins/uast-kotlin/testData/Resolve.kt +++ b/plugins/uast-kotlin/testData/Resolve.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + open class A { fun foo() {} inline fun inlineFoo() { @@ -30,4 +32,4 @@ fun > barTL(listT: T) { for (a in listT) { a.foo() } -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/SAM.kt b/plugins/uast-kotlin/testData/SAM.kt index f742415efaf..2a6695989be 100644 --- a/plugins/uast-kotlin/testData/SAM.kt +++ b/plugins/uast-kotlin/testData/SAM.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + import java.lang.Thread import java.lang.Runnable @@ -31,4 +33,4 @@ fun test3() { } fun ambiguousSamAcceptor(s: Supplier): String = TODO() -fun ambiguousSamAcceptor(s: Callable): String = TODO() \ No newline at end of file +fun ambiguousSamAcceptor(s: Callable): String = TODO() diff --git a/plugins/uast-kotlin/testData/SimpleAnnotated.kt b/plugins/uast-kotlin/testData/SimpleAnnotated.kt index eba544fa27c..08de31c627e 100644 --- a/plugins/uast-kotlin/testData/SimpleAnnotated.kt +++ b/plugins/uast-kotlin/testData/SimpleAnnotated.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + class SimpleAnnotated { @Suppress("abc") fun method() { @@ -6,4 +8,4 @@ class SimpleAnnotated { @kotlin.SinceKotlin("1.0") val property: String = "Mary" -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/SimpleScript.kts b/plugins/uast-kotlin/testData/SimpleScript.kts index 820bd87cd13..d97ea8027a9 100644 --- a/plugins/uast-kotlin/testData/SimpleScript.kts +++ b/plugins/uast-kotlin/testData/SimpleScript.kts @@ -1,3 +1,5 @@ +// !IGNORE_FIR + println("Hello World!") fun getBarOrNull(flag: Boolean): Bar? { diff --git a/plugins/uast-kotlin/testData/StringTemplate.kt b/plugins/uast-kotlin/testData/StringTemplate.kt index b8b252dfe46..d318a385e5c 100644 --- a/plugins/uast-kotlin/testData/StringTemplate.kt +++ b/plugins/uast-kotlin/testData/StringTemplate.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + val foo = "lorem" val bar = "ipsum" val baz = "dolor" diff --git a/plugins/uast-kotlin/testData/StringTemplateComplex.kt b/plugins/uast-kotlin/testData/StringTemplateComplex.kt index 7a45d83dbd2..ad85f5804aa 100644 --- a/plugins/uast-kotlin/testData/StringTemplateComplex.kt +++ b/plugins/uast-kotlin/testData/StringTemplateComplex.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + val muchRecur = "${"${"${"abc"}"}"}" val case4 = "a ${"literal"} z" diff --git a/plugins/uast-kotlin/testData/StringTemplateComplexForUInjectionHost.kt b/plugins/uast-kotlin/testData/StringTemplateComplexForUInjectionHost.kt index 7a45d83dbd2..ad85f5804aa 100644 --- a/plugins/uast-kotlin/testData/StringTemplateComplexForUInjectionHost.kt +++ b/plugins/uast-kotlin/testData/StringTemplateComplexForUInjectionHost.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + val muchRecur = "${"${"${"abc"}"}"}" val case4 = "a ${"literal"} z" diff --git a/plugins/uast-kotlin/testData/StringTemplateInClass.kt b/plugins/uast-kotlin/testData/StringTemplateInClass.kt index 01c380c96b8..d00d2c5370b 100644 --- a/plugins/uast-kotlin/testData/StringTemplateInClass.kt +++ b/plugins/uast-kotlin/testData/StringTemplateInClass.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + class Demo { val foo = X.bar("lorem") } diff --git a/plugins/uast-kotlin/testData/StringTemplateWithVar.kt b/plugins/uast-kotlin/testData/StringTemplateWithVar.kt index ea64ccac87c..5000cd8eb1a 100644 --- a/plugins/uast-kotlin/testData/StringTemplateWithVar.kt +++ b/plugins/uast-kotlin/testData/StringTemplateWithVar.kt @@ -1,2 +1,4 @@ +// !IGNORE_FIR + val bar = "bar" val f = "foo$bar" diff --git a/plugins/uast-kotlin/testData/SuperCalls.kt b/plugins/uast-kotlin/testData/SuperCalls.kt index 764bbaf009b..77693508b8a 100644 --- a/plugins/uast-kotlin/testData/SuperCalls.kt +++ b/plugins/uast-kotlin/testData/SuperCalls.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + open class A(val str: String) { constructor(i: Int) : this(i.toString()) @@ -30,4 +32,4 @@ val anon = object : A("textForAnon") { inner class InnerClass : A("inner class") } -fun cons(a: A) {} \ No newline at end of file +fun cons(a: A) {} diff --git a/plugins/uast-kotlin/testData/Suspend.kt b/plugins/uast-kotlin/testData/Suspend.kt index b95cfe3866d..4baf97c9a8c 100644 --- a/plugins/uast-kotlin/testData/Suspend.kt +++ b/plugins/uast-kotlin/testData/Suspend.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + package test.pkg class Context { diff --git a/plugins/uast-kotlin/testData/TryCatch.kt b/plugins/uast-kotlin/testData/TryCatch.kt index faf598d4f91..6a77ee76d0c 100644 --- a/plugins/uast-kotlin/testData/TryCatch.kt +++ b/plugins/uast-kotlin/testData/TryCatch.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + class TryCatch { fun catches() { try { diff --git a/plugins/uast-kotlin/testData/TypeAliasExpansionWithOtherAliasInArgument.kt b/plugins/uast-kotlin/testData/TypeAliasExpansionWithOtherAliasInArgument.kt index 39d33c38e6b..e22d6cab888 100644 --- a/plugins/uast-kotlin/testData/TypeAliasExpansionWithOtherAliasInArgument.kt +++ b/plugins/uast-kotlin/testData/TypeAliasExpansionWithOtherAliasInArgument.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + typealias A = String typealias My = (Map) -> Unit diff --git a/plugins/uast-kotlin/testData/TypeAliases.kt b/plugins/uast-kotlin/testData/TypeAliases.kt index 9af78b46f29..e1927b01dd3 100644 --- a/plugins/uast-kotlin/testData/TypeAliases.kt +++ b/plugins/uast-kotlin/testData/TypeAliases.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + class A typealias F = A.(A) -> A -typealias G = (F) -> F \ No newline at end of file +typealias G = (F) -> F diff --git a/plugins/uast-kotlin/testData/TypeInAnnotation.kt b/plugins/uast-kotlin/testData/TypeInAnnotation.kt index d7fd4b53e57..247055c43dd 100644 --- a/plugins/uast-kotlin/testData/TypeInAnnotation.kt +++ b/plugins/uast-kotlin/testData/TypeInAnnotation.kt @@ -1,6 +1,8 @@ +// !IGNORE_FIR + class C { @Test fun foo() { } -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/TypeReferences.kt b/plugins/uast-kotlin/testData/TypeReferences.kt index ab79a5175b0..3a4181a8dcd 100644 --- a/plugins/uast-kotlin/testData/TypeReferences.kt +++ b/plugins/uast-kotlin/testData/TypeReferences.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + fun foo(parameter: Int): String { val varWithType: String? = "Not Null" val varWithoutType = "lorem ipsum" diff --git a/plugins/uast-kotlin/testData/UnexpectedContainerException.kt b/plugins/uast-kotlin/testData/UnexpectedContainerException.kt index 73783d48455..03363a57835 100644 --- a/plugins/uast-kotlin/testData/UnexpectedContainerException.kt +++ b/plugins/uast-kotlin/testData/UnexpectedContainerException.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + interface Callback { fun onError(throwable: Throwable) } @@ -16,4 +18,4 @@ class Model { fun crashMe(clazz: Class, factory: () -> T) { throw UnsupportedOperationException() } -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/WhenAndDestructing.kt b/plugins/uast-kotlin/testData/WhenAndDestructing.kt index 9c377ca0bf3..07d00b5afbb 100644 --- a/plugins/uast-kotlin/testData/WhenAndDestructing.kt +++ b/plugins/uast-kotlin/testData/WhenAndDestructing.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + fun getElementsAdditionalResolve(string: String): String { val arr = listOf("1", "2") diff --git a/plugins/uast-kotlin/testData/WhenIs.kt b/plugins/uast-kotlin/testData/WhenIs.kt index 26b8065b8b7..4eb3d3ee92f 100644 --- a/plugins/uast-kotlin/testData/WhenIs.kt +++ b/plugins/uast-kotlin/testData/WhenIs.kt @@ -1,4 +1,6 @@ +// !IGNORE_FIR + fun foo(bar: Any) = when(bar) { is String -> bar !is String -> "" -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/WhenStringLiteral.kt b/plugins/uast-kotlin/testData/WhenStringLiteral.kt index e2d7c704483..54b86b701df 100644 --- a/plugins/uast-kotlin/testData/WhenStringLiteral.kt +++ b/plugins/uast-kotlin/testData/WhenStringLiteral.kt @@ -1,3 +1,5 @@ +// !IGNORE_FIR + val a = readLine() val b = when(a) { @@ -9,4 +11,4 @@ val b = when(a) { when(a) { "abc1" -> println(1) "def1", "ghi1" -> println(2) -} \ No newline at end of file +} diff --git a/plugins/uast-kotlin/testData/ea101715.kt b/plugins/uast-kotlin/testData/ea101715.kt index 262edcb4f9d..18cb249c30f 100644 --- a/plugins/uast-kotlin/testData/ea101715.kt +++ b/plugins/uast-kotlin/testData/ea101715.kt @@ -1,5 +1,7 @@ +// !IGNORE_FIR + fun a() { val a = Obj(555) } -object Obj \ No newline at end of file +object Obj