diff --git a/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInside.kt b/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInside.kt new file mode 100644 index 00000000000..064bc11bac4 --- /dev/null +++ b/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInside.kt @@ -0,0 +1,45 @@ +package myPack + +@Target( + AnnotationTarget.PROPERTY, + AnnotationTarget.TYPE_PARAMETER, + AnnotationTarget.FUNCTION, + AnnotationTarget.VALUE_PARAMETER, + AnnotationTarget.TYPE, + AnnotationTarget.EXPRESSION, +) +@Retention(AnnotationRetention.SOURCE) +annotation class Anno(val number: Int)/* DeclarationStructureElement *//* ClassDeclarationStructureElement */ + +@Anno(functionProperty) +const val functionProperty = 42/* DeclarationStructureElement */ + +@Anno(parameterProperty) +const val parameterProperty = 42/* DeclarationStructureElement */ + +@Anno(defaultValueProperty) +const val defaultValueProperty = 42/* DeclarationStructureElement */ + +@Anno(receiverProperty) +const val receiverProperty = 42/* DeclarationStructureElement */ + +@Anno(receiverTypeProperty) +const val receiverTypeProperty = 42/* DeclarationStructureElement */ + +@Anno(typeParameterProperty) +const val typeParameterProperty = 42/* DeclarationStructureElement */ + +@Anno(valueParameterTypeProperty) +const val valueParameterTypeProperty = 42/* DeclarationStructureElement */ + +@Anno(expressionProperty) +const val expressionProperty = 42/* DeclarationStructureElement */ + +fun topLevelFun() = run { + @Anno(functionProperty) + fun <@Anno(typeParameterProperty) T> @receiver:Anno(receiverProperty) @Anno(receiverTypeProperty) Int.function( + @Anno(parameterProperty) param: @Anno( + valueParameterTypeProperty + ) Int = defaultValueProperty, + ) = @Anno(expressionProperty) "str" +}/* DeclarationStructureElement */ diff --git a/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInside.lazy.resolve.txt b/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInside.lazy.resolve.txt new file mode 100644 index 00000000000..5a8a18c7217 --- /dev/null +++ b/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInside.lazy.resolve.txt @@ -0,0 +1,35 @@ +FILE: [ResolvedTo(BODY_RESOLVE)] functionWithImplicitTypeAndFunctionInside.kt + @R|kotlin/annotation/Target|[Types](allowedTargets = vararg(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.PROPERTY|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE_PARAMETER|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.FUNCTION|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.VALUE_PARAMETER|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.EXPRESSION|)) @R|kotlin/annotation/Retention|[Types](value = Q|kotlin/annotation/AnnotationRetention|.R|kotlin/annotation/AnnotationRetention.SOURCE|) public final [ResolvedTo(BODY_RESOLVE)] annotation class Anno : R|kotlin/Annotation| { + public [ResolvedTo(BODY_RESOLVE)] constructor([ResolvedTo(BODY_RESOLVE)] number: R|kotlin/Int|): R|myPack/Anno| { + super() + } + + public final [ResolvedTo(BODY_RESOLVE)] val number: R|kotlin/Int| = R|/number| + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + + } + @R|myPack/Anno|[Types](number = R|myPack/functionProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val functionProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/parameterProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val parameterProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/defaultValueProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val defaultValueProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/receiverProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val receiverProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/receiverTypeProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val receiverTypeProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/typeParameterProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val typeParameterProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/valueParameterTypeProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val valueParameterTypeProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/expressionProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val expressionProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + public final [ResolvedTo(BODY_RESOLVE)] fun topLevelFun(): R|kotlin/Unit| { + ^topLevelFun R|kotlin/run|( = [ResolvedTo(BODY_RESOLVE)] run@fun (): R|kotlin/Unit| { + @R|myPack/Anno|[Types](number = R|myPack/functionProperty|) local final [ResolvedTo(BODY_RESOLVE)] fun <@R|myPack/Anno|[Types](number = R|myPack/typeParameterProperty|) [ResolvedTo(BODY_RESOLVE)] T> @RECEIVER:R|myPack/Anno|[Types](number = R|myPack/receiverProperty|) R|@R|myPack/Anno|(number = R|myPack/receiverTypeProperty|) kotlin/Int|.function([ResolvedTo(BODY_RESOLVE)] @R|myPack/Anno|[Types](number = R|myPack/parameterProperty|) param: R|@R|myPack/Anno|(number = R|myPack/valueParameterTypeProperty|) kotlin/Int| = R|myPack/defaultValueProperty|): R|kotlin/String| { + ^function @R|myPack/Anno|[Types](number = R|myPack/expressionProperty|) String(str) + } + + } + ) + } diff --git a/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInside.out_of_src_roots.lazy.resolve.txt b/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInside.out_of_src_roots.lazy.resolve.txt new file mode 100644 index 00000000000..7cdaa95aa3f --- /dev/null +++ b/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInside.out_of_src_roots.lazy.resolve.txt @@ -0,0 +1,35 @@ +FILE: [ResolvedTo(BODY_RESOLVE)] functionWithImplicitTypeAndFunctionInside.kt + @R|kotlin/annotation/Target|[Types](allowedTargets = vararg(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.PROPERTY|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE_PARAMETER|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.FUNCTION|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.VALUE_PARAMETER|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.EXPRESSION|)) @R|kotlin/annotation/Retention|[Types](value = Q|kotlin/annotation/AnnotationRetention|.R|kotlin/annotation/AnnotationRetention.SOURCE|) public final [ResolvedTo(BODY_RESOLVE)] annotation class Anno : R|kotlin/Annotation| { + public [ResolvedTo(BODY_RESOLVE)] constructor([ResolvedTo(BODY_RESOLVE)] number: R|kotlin/Int|): R|myPack/Anno| { + super() + } + + public final [ResolvedTo(BODY_RESOLVE)] val number: R|kotlin/Int| = R|/number| + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + + } + @R|myPack/Anno|[Types](number = R|myPack/functionProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val functionProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/parameterProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val parameterProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/defaultValueProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val defaultValueProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/receiverProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val receiverProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/receiverTypeProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val receiverTypeProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/typeParameterProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val typeParameterProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/valueParameterTypeProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val valueParameterTypeProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/expressionProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val expressionProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + public final [ResolvedTo(BODY_RESOLVE)] fun topLevelFun(): { + ^topLevelFun #( = [ResolvedTo(BODY_RESOLVE)] run@fun (): R|kotlin/Unit| { + @R|myPack/Anno|[Types](number = R|myPack/functionProperty|) local final [ResolvedTo(BODY_RESOLVE)] fun <@R|myPack/Anno|[Types](number = R|myPack/typeParameterProperty|) [ResolvedTo(BODY_RESOLVE)] T> @RECEIVER:R|myPack/Anno|[Types](number = R|myPack/receiverProperty|) R|@R|myPack/Anno|(number = R|myPack/receiverTypeProperty|) kotlin/Int|.function([ResolvedTo(BODY_RESOLVE)] @R|myPack/Anno|[Types](number = R|myPack/parameterProperty|) param: R|@R|myPack/Anno|(number = R|myPack/valueParameterTypeProperty|) kotlin/Int| = R|myPack/defaultValueProperty|): R|kotlin/String| { + ^function @R|myPack/Anno|[Types](number = R|myPack/expressionProperty|) String(str) + } + + } + ) + } diff --git a/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInsideLocalClass.kt b/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInsideLocalClass.kt new file mode 100644 index 00000000000..3d877e00ff8 --- /dev/null +++ b/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInsideLocalClass.kt @@ -0,0 +1,49 @@ +package myPack + +@Target( + AnnotationTarget.PROPERTY, + AnnotationTarget.TYPE_PARAMETER, + AnnotationTarget.FUNCTION, + AnnotationTarget.VALUE_PARAMETER, + AnnotationTarget.TYPE, + AnnotationTarget.EXPRESSION, +) +@Retention(AnnotationRetention.SOURCE) +annotation class Anno(val number: Int)/* DeclarationStructureElement *//* ClassDeclarationStructureElement */ + +@Anno(functionProperty) +const val functionProperty = 42/* DeclarationStructureElement */ + +@Anno(parameterProperty) +const val parameterProperty = 42/* DeclarationStructureElement */ + +@Anno(defaultValueProperty) +const val defaultValueProperty = 42/* DeclarationStructureElement */ + +@Anno(receiverProperty) +const val receiverProperty = 42/* DeclarationStructureElement */ + +@Anno(receiverTypeProperty) +const val receiverTypeProperty = 42/* DeclarationStructureElement */ + +@Anno(typeParameterProperty) +const val typeParameterProperty = 42/* DeclarationStructureElement */ + +@Anno(valueParameterTypeProperty) +const val valueParameterTypeProperty = 42/* DeclarationStructureElement */ + +@Anno(expressionProperty) +const val expressionProperty = 42/* DeclarationStructureElement */ + +fun topLevelFun() {/* DeclarationStructureElement */ + class LocalClass { + fun first() = 42.function() + + @Anno(functionProperty) + fun <@Anno(typeParameterProperty) T> @receiver:Anno(receiverProperty) @Anno(receiverTypeProperty) T.function( + @Anno(parameterProperty) param: @Anno( + valueParameterTypeProperty + ) String = "${defaultValueProperty}", + ) = @Anno(expressionProperty) "str" + } +} diff --git a/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInsideLocalClass.lazy.resolve.txt b/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInsideLocalClass.lazy.resolve.txt new file mode 100644 index 00000000000..d84d7c2cc3f --- /dev/null +++ b/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInsideLocalClass.lazy.resolve.txt @@ -0,0 +1,43 @@ +FILE: [ResolvedTo(BODY_RESOLVE)] functionWithImplicitTypeAndFunctionInsideLocalClass.kt + @R|kotlin/annotation/Target|[Types](allowedTargets = vararg(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.PROPERTY|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE_PARAMETER|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.FUNCTION|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.VALUE_PARAMETER|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.EXPRESSION|)) @R|kotlin/annotation/Retention|[Types](value = Q|kotlin/annotation/AnnotationRetention|.R|kotlin/annotation/AnnotationRetention.SOURCE|) public final [ResolvedTo(BODY_RESOLVE)] annotation class Anno : R|kotlin/Annotation| { + public [ResolvedTo(BODY_RESOLVE)] constructor([ResolvedTo(BODY_RESOLVE)] number: R|kotlin/Int|): R|myPack/Anno| { + super() + } + + public final [ResolvedTo(BODY_RESOLVE)] val number: R|kotlin/Int| = R|/number| + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + + } + @R|myPack/Anno|[Types](number = R|myPack/functionProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val functionProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/parameterProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val parameterProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/defaultValueProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val defaultValueProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/receiverProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val receiverProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/receiverTypeProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val receiverTypeProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/typeParameterProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val typeParameterProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/valueParameterTypeProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val valueParameterTypeProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + @R|myPack/Anno|[Types](number = R|myPack/expressionProperty|) public final const [ResolvedTo(BODY_RESOLVE)] val expressionProperty: R|kotlin/Int| = Int(42) + public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| + public final [ResolvedTo(BODY_RESOLVE)] fun topLevelFun(): R|kotlin/Unit| { + local final [ResolvedTo(BODY_RESOLVE)] class LocalClass : R|kotlin/Any| { + public [ResolvedTo(BODY_RESOLVE)] constructor(): R|/LocalClass| { + super() + } + + public final [ResolvedTo(BODY_RESOLVE)] fun first(): R|kotlin/String| { + ^first (this@R|/LocalClass|, Int(42)).R|/function|() + } + + @R|myPack/Anno|[Types](number = R|myPack/functionProperty|) public final [ResolvedTo(BODY_RESOLVE)] fun <@R|myPack/Anno|[Types](number = R|myPack/typeParameterProperty|) [ResolvedTo(BODY_RESOLVE)] T> @RECEIVER:R|myPack/Anno|[Types](number = R|myPack/receiverProperty|) R|@R|myPack/Anno|(number = R|myPack/receiverTypeProperty|) T|.function([ResolvedTo(BODY_RESOLVE)] @R|myPack/Anno|[Types](number = R|myPack/parameterProperty|) param: R|@R|myPack/Anno|(number = R|myPack/valueParameterTypeProperty|) kotlin/String| = (R|myPack/defaultValueProperty|)): R|kotlin/String| { + ^function @R|myPack/Anno|[Types](number = R|myPack/expressionProperty|) String(str) + } + + } + + } diff --git a/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInsideLocalClassScript.kts b/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInsideLocalClassScript.kts new file mode 100644 index 00000000000..0de145a2a27 --- /dev/null +++ b/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInsideLocalClassScript.kts @@ -0,0 +1,49 @@ +package myPack/* RootScriptStructureElement */ + +@Target( + AnnotationTarget.PROPERTY, + AnnotationTarget.TYPE_PARAMETER, + AnnotationTarget.FUNCTION, + AnnotationTarget.VALUE_PARAMETER, + AnnotationTarget.TYPE, + AnnotationTarget.EXPRESSION, +) +@Retention(AnnotationRetention.SOURCE) +annotation class Anno(val number: Int)/* DeclarationStructureElement *//* ClassDeclarationStructureElement */ + +@Anno(functionProperty) +const val functionProperty = 42/* DeclarationStructureElement */ + +@Anno(parameterProperty) +const val parameterProperty = 42/* DeclarationStructureElement */ + +@Anno(defaultValueProperty) +const val defaultValueProperty = 42/* DeclarationStructureElement */ + +@Anno(receiverProperty) +const val receiverProperty = 42/* DeclarationStructureElement */ + +@Anno(receiverTypeProperty) +const val receiverTypeProperty = 42/* DeclarationStructureElement */ + +@Anno(typeParameterProperty) +const val typeParameterProperty = 42/* DeclarationStructureElement */ + +@Anno(valueParameterTypeProperty) +const val valueParameterTypeProperty = 42/* DeclarationStructureElement */ + +@Anno(expressionProperty) +const val expressionProperty = 42/* DeclarationStructureElement */ + +fun topLevelFun() {/* DeclarationStructureElement */ + class LocalClass { + fun first() = 42.function() + + @Anno(functionProperty) + fun <@Anno(typeParameterProperty) T> @receiver:Anno(receiverProperty) @Anno(receiverTypeProperty) T.function( + @Anno(parameterProperty) param: @Anno( + valueParameterTypeProperty + ) String = "${defaultValueProperty}", + ) = @Anno(expressionProperty) "str" + } +} diff --git a/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInsideLocalClassScript.lazy.resolve.txt b/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInsideLocalClassScript.lazy.resolve.txt new file mode 100644 index 00000000000..9d8d45ac47e --- /dev/null +++ b/analysis/low-level-api-fir/testData/fileStructure/functionWithImplicitTypeAndFunctionInsideLocalClassScript.lazy.resolve.txt @@ -0,0 +1,57 @@ +FILE: [ResolvedTo(BODY_RESOLVE)] functionWithImplicitTypeAndFunctionInsideLocalClassScript.kts + context(