diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt index 53f5bad4982..e8c8b52ef8a 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt @@ -158,12 +158,7 @@ class KotlinCallCompleter( // this is needed at least for non-local return checker, because when we analyze lambda we should already bind descriptor for outer call candidate?.resolvedCall?.let { - val mayNeedDescriptor = it.argumentToCandidateParameter.keys.any { arg -> - arg is LambdaKotlinCallArgument - } - if (mayNeedDescriptor) { - resolutionCallbacks.bindStubResolvedCallForCandidate(it) - } + resolutionCallbacks.bindStubResolvedCallForCandidate(it) resolutionCallbacks.disableContractsIfNecessary(it) } diff --git a/compiler/testData/diagnostics/tests/inference/tooEagerSmartcast.kt b/compiler/testData/diagnostics/tests/inference/tooEagerSmartcast.kt index 7a24f5ee640..36cf744239c 100644 --- a/compiler/testData/diagnostics/tests/inference/tooEagerSmartcast.kt +++ b/compiler/testData/diagnostics/tests/inference/tooEagerSmartcast.kt @@ -36,7 +36,7 @@ fun Number.num() {} fun main(b: Base) { b.foo().num() if (b is Derived<*>) { - b.foo().num() + b.foo().num() b.baz().length } } diff --git a/compiler/testData/diagnostics/tests/regressions/kt12898.kt b/compiler/testData/diagnostics/tests/regressions/kt12898.kt index e573d011812..72f52c800ee 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt12898.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt12898.kt @@ -8,9 +8,9 @@ interface B { class C(override val t: Any?) : B fun f(b: B<*, Any>) { - val y = b.t + val y = b.t if (y is String?) { - y.length + y.length } } diff --git a/compiler/testData/diagnostics/tests/regressions/kt30245.kt b/compiler/testData/diagnostics/tests/regressions/kt30245.kt index 6fa6187ce16..4eaa2e67876 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt30245.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt30245.kt @@ -78,8 +78,8 @@ fun test2() { // to extension lambda 1 // val w27 = W2 { i, s: String -> i + s.length } // overload oi- ni- // val i27: E1 = id { i, s: String -> i + s.length } // overload oi- ni- - val w28 = W2 { i: Int, s -> i + s.length } // oi- ni- - val i28: E1 = id { i: Int, s -> i + s.length } // oi- ni- + val w28 = W2 { i: Int, s -> i + s.length } // oi- ni- + val i28: E1 = id { i: Int, s -> i + s.length } // oi- ni- val w29 = W2 { i: Int, s: String -> i + s.length } // oi- ni- val i29: E1 = id { i: Int, s: String -> i + s.length } // oi+ ni+ diff --git a/compiler/testData/diagnostics/tests/regressions/kt31975.kt b/compiler/testData/diagnostics/tests/regressions/kt31975.kt index f38ee5a008c..1b59ff233d1 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt31975.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt31975.kt @@ -10,7 +10,7 @@ interface A interface TypeConstructor class Refiner { - val memoizedFunctionLambda = createMemoizedFunction { it.foo() } // error type infered, no diagnostic, BAD, backend fails + val memoizedFunctionLambda = createMemoizedFunction { it.foo() } // error type infered, no diagnostic, BAD, backend fails val memoizedFunctionReference = createMemoizedFunction(TypeConstructor::foo) // EXTENSION_IN_CLASS_REFERENCE_IS_NOT_ALLOWED, fine val memoizedFunctionTypes = createMemoizedFunction { it.foo() } // works fine diff --git a/compiler/testData/diagnostics/tests/samConversions/OverloadPriority.kt b/compiler/testData/diagnostics/tests/samConversions/OverloadPriority.kt index f108ab528f9..5fc2e26224d 100644 --- a/compiler/testData/diagnostics/tests/samConversions/OverloadPriority.kt +++ b/compiler/testData/diagnostics/tests/samConversions/OverloadPriority.kt @@ -27,5 +27,5 @@ fun test(j: J) { j.bas({ it checkType { _() }; "" }, "") checkType { _() } // NI: TODO - j.bar { it checkType { _() }; "" } checkType { _() } + j.bar { it checkType { _() }; "" } checkType { _() } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/samConversions/OverloadPriorityKT.kt b/compiler/testData/diagnostics/tests/samConversions/OverloadPriorityKT.kt index e6153c5b49d..3c30a5bc341 100644 --- a/compiler/testData/diagnostics/tests/samConversions/OverloadPriorityKT.kt +++ b/compiler/testData/diagnostics/tests/samConversions/OverloadPriorityKT.kt @@ -26,5 +26,5 @@ fun test(k: K) { k.bas { it checkType { _() }; "" } checkType { _() } // NI: TODO - k.bar { it checkType { _() }; "" } checkType { _() } + k.bar { it checkType { _() }; "" } checkType { _() } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/callableReferenceOnUnresolvedLHS.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/callableReferenceOnUnresolvedLHS.kt index 8b55b9c80f5..3ca5c9a8160 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/callableReferenceOnUnresolvedLHS.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/callableReferenceOnUnresolvedLHS.kt @@ -8,6 +8,6 @@ class Scope(private val implClass: hm = c.asSequence() .filter(implClass::isInstance) .map(implClass::cast) - .toSet() + .toSet() } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.kt index 51581791a85..90089af0dd4 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.kt @@ -189,42 +189,42 @@ fun case_12(x: TypealiasNullableStringIndirect, y: TypealiasNullableStringIndire // TESTCASE NUMBER: 13 fun case_13(x: otherpackage.Case13?) = - if ((x == null !is Boolean) !== true) { + if ((x == null !is Boolean) !== true) { throw Exception() } else { x - x.equals(x) + x.equals(x) } // TESTCASE NUMBER: 14 class Case14 { val x: otherpackage.Case14? init { - x = otherpackage.Case14() + x = otherpackage.Case14() } } fun case_14() { val a = Case14() - if (a.x != null !is Boolean !is Boolean) { - if (a.x != null == true) { + if (a.x != null !is Boolean !is Boolean) { + if (a.x != null == true) { if (a.x !== null == false) { - if (a.x != null == null) { - if (a.x != null !== null) { - if (a.x != null === true) { + if (a.x != null == null) { + if (a.x != null !== null) { + if (a.x != null === true) { if (a.x !== null === true !is Boolean == true) { - if (a.x != null !== false) { - if (a.x != null === false) { + if (a.x != null !== false) { + if (a.x != null === false) { if (a.x !== null === true) { - if ((a.x != null != true) !is Boolean) { - if (a.x != null is Boolean) { - if (a.x != null is Boolean is Boolean) { + if ((a.x != null != true) !is Boolean) { + if (a.x != null is Boolean) { + if (a.x != null is Boolean is Boolean) { if (a.x !== null is Boolean) { - if (a.x != null is Boolean) { + if (a.x != null is Boolean) { if ((a.x !== null !is Boolean) == false) { a.x - a.x.equals(a.x) + a.x.equals(a.x) } } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/10.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/10.kt index 09f083015c2..92c73c4178f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/10.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/10.kt @@ -22,5 +22,5 @@ fun case_1() { } x - x.inv() + x.inv() } \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.kt index 89360a89d13..8a6703de417 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.kt @@ -15,7 +15,7 @@ fun case_1(x: Any?) { if (x is Int is Boolean) { x - x.inv() + x.inv() x.not() x.propAny x.funAny() @@ -26,7 +26,7 @@ fun case_1(x: Any?) { fun case_2(x: Any?) { if (x is Int is Any? is Boolean) { x - x.inv() + x.inv() x.not() x.propAny x.funAny() @@ -37,7 +37,7 @@ fun case_2(x: Any?) { inline fun case_3(x: Any?) { if (x is Int is T) { x - x.inv() + x.inv() x.propAny x.funAny() } @@ -47,7 +47,7 @@ inline fun case_3(x: Any?) { inline fun Boolean>case_4(x: Any?) { if (x is Int is T == null) { x - x.inv() + x.inv() x.propAny x.funAny() } @@ -57,7 +57,7 @@ inline fun Boolean>case_4(x: Any?) { fun case_5(x: Any?) { if (x is Int != null) { x - x.inv() + x.inv() x.propAny x.funAny() } @@ -67,7 +67,7 @@ fun case_5(x: Any?) { fun case_6(x: Any?) { if (x is Int == null) { x - x.inv() + x.inv() x.propAny x.funAny() } @@ -77,7 +77,7 @@ fun case_6(x: Any?) { fun case_7(x: Any?) { if (!(x !is Int) == false) { x - x.inv() + x.inv() x.propAny x.funAny() } @@ -87,7 +87,7 @@ fun case_7(x: Any?) { fun case_8(x: Any?) { if (!(x !is Int) == true) else { x - x.inv() + x.inv() x.propAny x.funAny() } @@ -97,7 +97,7 @@ fun case_8(x: Any?) { fun case_9(x: Any?) { if (x !is Int !is Any?) { x - x.inv() + x.inv() x.propAny x.funAny() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.kt index 2d572288d9e..daba37cebb9 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.kt @@ -162,7 +162,7 @@ fun case_14(x: Any) { x.NaN } else { x - x.inv() + x.inv() } } } \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.kt index b458cfa95cf..c828ce9f5a4 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.kt @@ -72,7 +72,7 @@ fun case_5(x: SealedClass) { when (x) { is SealedChild1 -> x.number is SealedChild2 -> x.e1 + x.e2 - else -> x.m1 + x.m1 + else -> x.m1 + x.m1 } } @@ -85,6 +85,6 @@ fun case_6(x: SealedClass?) { is SealedChild1 -> x.number is SealedChild2 -> x.e1 + x.e2 null -> {} - else -> x.m1 + x.m1 + else -> x.m1 + x.m1 } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/44.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/44.kt index aa1bb038aae..0a99451b8a3 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/44.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/44.kt @@ -29,7 +29,7 @@ fun case_1(x: Int?) { fun case_2(x: Any?) { val y = x is Int if (y) { - x.inv() + x.inv() } } @@ -40,7 +40,7 @@ fun case_2(x: Any?) { fun case_3(x: T) { val y = x is Int if (y) { - x.inv() + x.inv() } } @@ -51,6 +51,6 @@ fun case_3(x: T) { fun case_4(x: T) { val y = x is Int? if (y) { - x?.inv() + x?.inv() } } \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.kt index 2d077de237b..0bcb08ece9b 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.kt @@ -15,7 +15,7 @@ fun case_1(x: Any?) { if (x is Int || x !is Int) { x - x.inv() + x.inv() } } @@ -73,7 +73,7 @@ fun case_7(x: Any) { fun case_8(x: Any?) { if (x is Int? == x is Int?) else { x - x?.inv() + x?.inv() } } @@ -82,7 +82,7 @@ fun case_9(x: Any?) { if (!!!(x !is TypealiasNullableStringIndirect?)) else { if (!(x !is TypealiasNullableStringIndirect?)) else { x - x?.get(0) + x?.get(0) } } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.kt index 044de9c1ae3..7759beeb3ea 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.kt @@ -91,7 +91,7 @@ fun case_8(x: Any?) { fun case_9(x: Any?) { if (true && true && !!(x !is TypealiasNullableStringIndirect?) && true && true && true && true) else { x - x?.get(0) + x?.get(0) } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.kt index 6665e13d297..dacd7086943 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.kt @@ -27,7 +27,7 @@ fun case_1(x: Any?) { fun case_2(x: Any) { if (x is Int === true) { x - x.inv() + x.inv() } } @@ -83,7 +83,7 @@ fun case_7(x: Any) { fun case_8(x: Any?) { if (!(x is Int?) !== false !== false !== false) else { x - x?.inv() + x?.inv() } } @@ -95,7 +95,7 @@ fun case_8(x: Any?) { fun case_9(x: Any?) { if (!!(x !is TypealiasNullableStringIndirect?) !== false === true) else { x - x?.get(0) + x?.get(0) } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/39.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/39.kt index dd9ec9dc056..c49bb70edb9 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/39.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/39.kt @@ -21,7 +21,7 @@ fun case_1(x: Number?) { if (x == y) { x - x.inv() + x.inv() } } @@ -56,7 +56,7 @@ fun case_4() { if (x == y) { x - x?.inv() + x?.inv() } } @@ -68,6 +68,6 @@ fun case_4() { fun case_5(x: Class, y: Class) { if (x.prop_14 == y.prop_15) { ?")!>x.prop_14 - ?")!>x.prop_14.inv() + ?")!>x.prop_14.inv() } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.kt index 2dc3681b999..d56385eaba6 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.kt @@ -33,7 +33,7 @@ fun case_1(x: Any?, y: Any?) { fun case_2(x: Any?, y: Any?) { if (x as Int === y) { x - x.inv(10) + x.inv(10) y y.inv(10) } @@ -61,7 +61,7 @@ fun case_3(x: Any?, y: Any?) { fun case_4(x: Any?, y: Any?) { if (y === x as Int) { x - x.inv(10) + x.inv(10) y y.inv(10) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.kt index 50895cbcc6d..cee0c20d232 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.kt @@ -19,7 +19,7 @@ fun case_1(x: Any?) { if (x is Int == @RetentionSourceAndTargetExpression true) { x - x.inv() + x.inv() } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.kt index c169e1777e1..bd455460119 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.kt @@ -17,7 +17,7 @@ fun case_1(x: Any?) { if (x!! is Int) { x - x.inv() + x.inv() } } @@ -32,7 +32,7 @@ fun case_2(x: Any?) { fun case_3(x: Any?) { if (x as Number? is Int) { x - x.inv() + x.inv() } } diff --git a/idea/testData/multiModuleHighlighting/differentJdk/mockJdk/main.kt b/idea/testData/multiModuleHighlighting/differentJdk/mockJdk/main.kt index 57908684520..1fadfce7269 100644 --- a/idea/testData/multiModuleHighlighting/differentJdk/mockJdk/main.kt +++ b/idea/testData/multiModuleHighlighting/differentJdk/mockJdk/main.kt @@ -50,5 +50,5 @@ fun buildList(): List = null!! fun myFile(): File = null!! fun mainJdk6(x: List) { - x.stream().filter { it.length > 0 } + x.stream().filter { it.length > 0 } } diff --git a/idea/testData/multiplatform/typeAliasToExpectClassExplicitReference/jvm/jvm.kt b/idea/testData/multiplatform/typeAliasToExpectClassExplicitReference/jvm/jvm.kt index 7c16bca35e6..f1c603df801 100644 --- a/idea/testData/multiplatform/typeAliasToExpectClassExplicitReference/jvm/jvm.kt +++ b/idea/testData/multiplatform/typeAliasToExpectClassExplicitReference/jvm/jvm.kt @@ -5,6 +5,6 @@ actual class A { } fun test() { - TypealiasFromCommon().commonMember() - TypealiasFromCommon().platformwMember() + TypealiasFromCommon().commonMember() + TypealiasFromCommon().platformwMember() } \ No newline at end of file diff --git a/idea/testData/multiplatform/useCorrectBuiltIns/common/common.kt b/idea/testData/multiplatform/useCorrectBuiltIns/common/common.kt index af5ca42c9b6..c85eec1e4ed 100644 --- a/idea/testData/multiplatform/useCorrectBuiltIns/common/common.kt +++ b/idea/testData/multiplatform/useCorrectBuiltIns/common/common.kt @@ -12,5 +12,5 @@ fun nativeSpecific() { } fun jsSpecific() { - val windowClosed = window.closed + val windowClosed = window.closed } \ No newline at end of file diff --git a/idea/testData/multiplatform/useCorrectBuiltIns/jvmWithSdk/jvmWithSdk.kt b/idea/testData/multiplatform/useCorrectBuiltIns/jvmWithSdk/jvmWithSdk.kt index 539574f2480..2c7f1388846 100644 --- a/idea/testData/multiplatform/useCorrectBuiltIns/jvmWithSdk/jvmWithSdk.kt +++ b/idea/testData/multiplatform/useCorrectBuiltIns/jvmWithSdk/jvmWithSdk.kt @@ -12,5 +12,5 @@ fun nativeSpecific() { } fun jsSpecific() { - val windowClosed = window.closed + val windowClosed = window.closed } \ No newline at end of file diff --git a/idea/testData/multiplatform/useCorrectBuiltIns/native/native.kt b/idea/testData/multiplatform/useCorrectBuiltIns/native/native.kt index af5ca42c9b6..c85eec1e4ed 100644 --- a/idea/testData/multiplatform/useCorrectBuiltIns/native/native.kt +++ b/idea/testData/multiplatform/useCorrectBuiltIns/native/native.kt @@ -12,5 +12,5 @@ fun nativeSpecific() { } fun jsSpecific() { - val windowClosed = window.closed + val windowClosed = window.closed } \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/inline/AbstractInlineTest.kt b/idea/tests/org/jetbrains/kotlin/idea/refactoring/inline/AbstractInlineTest.kt index e6c44a6c49d..5fd9a8802d2 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/refactoring/inline/AbstractInlineTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/refactoring/inline/AbstractInlineTest.kt @@ -47,7 +47,7 @@ abstract class AbstractInlineTest : KotlinLightCodeInsightFixtureTestCase() { val afterFileExists = afterFile.exists() val targetElement = - TargetElementUtil.findTargetElement(myFixture.editor, ELEMENT_NAME_ACCEPTED or REFERENCED_ELEMENT_ACCEPTED) ?: return + TargetElementUtil.findTargetElement(myFixture.editor, ELEMENT_NAME_ACCEPTED or REFERENCED_ELEMENT_ACCEPTED)!! @Suppress("DEPRECATION") val handler = Extensions.getExtensions(InlineActionHandler.EP_NAME).firstOrNull { it.canInlineElement(targetElement) } diff --git a/plugins/uast-kotlin/testData/DestructuringDeclaration.log-ide.txt b/plugins/uast-kotlin/testData/DestructuringDeclaration.log-ide.txt new file mode 100644 index 00000000000..77771a8dd73 --- /dev/null +++ b/plugins/uast-kotlin/testData/DestructuringDeclaration.log-ide.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 = var268d41a5) + UAnnotation (fqName = null) + UBinaryExpression (operator = ) + ULiteralExpression (value = "foo") + ULiteralExpression (value = 1) + ULocalVariable (name = a) + UAnnotation (fqName = null) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = var268d41a5) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (component1)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + ULocalVariable (name = b) + UAnnotation (fqName = null) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = var268d41a5) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (component2)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + UDeclarationsExpression + ULocalVariable (name = var465978a0) + 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 = var465978a0) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (component1)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + ULocalVariable (name = v) + UAnnotation (fqName = null) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = var465978a0) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (component2)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) diff --git a/plugins/uast-kotlin/testData/DestructuringDeclaration.render-ide.txt b/plugins/uast-kotlin/testData/DestructuringDeclaration.render-ide.txt new file mode 100644 index 00000000000..03647158190 --- /dev/null +++ b/plugins/uast-kotlin/testData/DestructuringDeclaration.render-ide.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 var268d41a5: = "foo" 1 + @null var a: java.lang.String = var268d41a5.() + @null var b: int = var268d41a5.() + @null @kotlin.Suppress(names = "UNCHECKED_CAST") var var465978a0: = data as kotlin.Pair + @null var k: java.lang.String = var465978a0.() + @null var v: java.lang.String = var465978a0.() + } +} diff --git a/plugins/uast-kotlin/testData/InnerNonFixedTypeVariable.types.txt b/plugins/uast-kotlin/testData/InnerNonFixedTypeVariable.types.txt index 51fead0219e..754530b1c46 100644 --- a/plugins/uast-kotlin/testData/InnerNonFixedTypeVariable.types.txt +++ b/plugins/uast-kotlin/testData/InnerNonFixedTypeVariable.types.txt @@ -4,15 +4,15 @@ UFile (package = ) [public final class InnerNonFixedTypeVariableKt {...] UParameter (name = list) [@org.jetbrains.annotations.NotNull var list: java.util.List] UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull] UBlockExpression [{...}] : PsiType: - UQualifiedReferenceExpression [list.filterIsInstance().(mutableSetOf(), { ...})] : PsiType: + UQualifiedReferenceExpression [list.filterIsInstance().(mutableSetOf(), { ...})] : PsiType: UQualifiedReferenceExpression [list.filterIsInstance()] USimpleNameReferenceExpression (identifier = list) [list] : PsiType:List UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [filterIsInstance()] UIdentifier (Identifier (filterIsInstance)) [UIdentifier (Identifier (filterIsInstance))] USimpleNameReferenceExpression (identifier = filterIsInstance, resolvesTo = null) [filterIsInstance] - UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [(mutableSetOf(), { ...})] : PsiType: + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [(mutableSetOf(), { ...})] : PsiType: UIdentifier (Identifier (mapTo)) [UIdentifier (Identifier (mapTo))] - USimpleNameReferenceExpression (identifier = , resolvesTo = null) [] : PsiType: + USimpleNameReferenceExpression (identifier = , resolvesTo = null) [] : PsiType: UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [mutableSetOf()] : PsiType:Set UIdentifier (Identifier (mutableSetOf)) [UIdentifier (Identifier (mutableSetOf))] USimpleNameReferenceExpression (identifier = mutableSetOf, resolvesTo = null) [mutableSetOf] : PsiType:Set diff --git a/plugins/uast-kotlin/testData/LambdaReturn.log-ide.txt b/plugins/uast-kotlin/testData/LambdaReturn.log-ide.txt new file mode 100644 index 00000000000..4feec660772 --- /dev/null +++ b/plugins/uast-kotlin/testData/LambdaReturn.log-ide.txt @@ -0,0 +1,140 @@ +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 + 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 = vardbcd0724) + 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 = vardbcd0724) + 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 = vardbcd0724) + 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/testData/LambdaReturn.render-ide.txt b/plugins/uast-kotlin/testData/LambdaReturn.render-ide.txt new file mode 100644 index 00000000000..6c03aa8df48 --- /dev/null +++ b/plugins/uast-kotlin/testData/LambdaReturn.render-ide.txt @@ -0,0 +1,44 @@ +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({ + if (it > 5) return + var b: int = 1 + return it + b + }) + var x: kotlin.jvm.functions.Function0 = { + @org.jetbrains.annotations.NotNull var vardbcd0724: = listOf(1, 2) + @org.jetbrains.annotations.NotNull var a: int = vardbcd0724.() + @org.jetbrains.annotations.NotNull var b: int = vardbcd0724.() + } + 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/testData/WhenAndDestructing.log-ide.txt b/plugins/uast-kotlin/testData/WhenAndDestructing.log-ide.txt new file mode 100644 index 00000000000..061131ed262 --- /dev/null +++ b/plugins/uast-kotlin/testData/WhenAndDestructing.log-ide.txt @@ -0,0 +1,45 @@ +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) + UReturnExpression + ULiteralExpression (value = "bindingContext") + UBreakExpression (label = null) + USwitchClauseExpressionWithBody + UExpressionList (when_entry) + UDeclarationsExpression + ULocalVariable (name = var837f1e82) + UAnnotation (fqName = null) + USimpleNameReferenceExpression (identifier = arr) + ULocalVariable (name = bindingContext) + UAnnotation (fqName = null) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = var837f1e82) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (component1)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + ULocalVariable (name = statementFilter) + UAnnotation (fqName = null) + UQualifiedReferenceExpression + USimpleNameReferenceExpression (identifier = var837f1e82) + UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) + UIdentifier (Identifier (component2)) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) + UReturnExpression + USimpleNameReferenceExpression (identifier = bindingContext) + UBreakExpression (label = null) diff --git a/plugins/uast-kotlin/testData/WhenAndDestructing.render-ide.txt b/plugins/uast-kotlin/testData/WhenAndDestructing.render-ide.txt new file mode 100644 index 00000000000..f3e37e879f8 --- /dev/null +++ b/plugins/uast-kotlin/testData/WhenAndDestructing.render-ide.txt @@ -0,0 +1,21 @@ +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" -> { + return "bindingContext" + break + } + + -> { + @null var var837f1e82: = arr + @null var bindingContext: java.lang.String = var837f1e82.() + @null var statementFilter: java.lang.String = var837f1e82.() + return bindingContext + break + } + + } + + } +}