K2 scripting: fix containing decl for last script expression
Generally the wrapping anonymous initializer can be used as a "containing declaration" for some elements, but since the initialiser for the last script expression could be dropped (the expression could be converted to the result property), this may lead to the surprises, e.g. as described in KT-65984 This fix marks the last initialiser as local, preventing it from being referenced as "containing declaration". #KT-65984
This commit is contained in:
committed by
Space Team
parent
0c5b700523
commit
9ea775cbed
+34
@@ -0,0 +1,34 @@
|
||||
@R|foo/Anno|(position = <strcat>(String(local type ), R|foo/constant|)) kotlin/Int
|
||||
context -> FirPropertySymbol <local>/i
|
||||
anchor -> [FirPropertySymbol <local>/$$result]
|
||||
|
||||
@R|foo/Anno|(position = <strcat>(String(local type ), R|foo/constant|)) kotlin/Int
|
||||
context -> FirBackingFieldSymbol <local>/field from FirPropertySymbol <local>/i
|
||||
anchor -> [FirPropertySymbol <local>/$$result]
|
||||
|
||||
FILE: [ResolvedTo(IMPORTS)] resultBodyAnnotation.kts
|
||||
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||
SCRIPT: [ResolvedTo(TYPES)] <script-resultBodyAnnotation.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=foo/Anno.position] position: R|kotlin/String|): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val position: R|kotlin/String| = R|<local>/position|
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
|
||||
public final const [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val constant: R|kotlin/Int| = Int(0)
|
||||
public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): R|kotlin/Int|
|
||||
|
||||
public final [ResolvedTo(CONTRACTS)] fun foo([ResolvedTo(CONTRACTS)] action: R|() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final [ResolvedTo(BODY_RESOLVE)] val $$result: R|kotlin/Unit| = @R|foo/Anno|[Types](position = <strcat>(String(call ), R|foo/constant|)) R|foo/foo|(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0<kotlin/Unit>] foo@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/constant|)) [ResolvedTo(BODY_RESOLVE)] lval i: R|@R|foo/Anno|(position = <strcat>(String(local type ), R|foo/constant|)) kotlin/Int|
|
||||
}
|
||||
)
|
||||
public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Unit|
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
@R|foo/Anno|(position = <strcat>(String(local type ), R|foo/constant|)) kotlin/Int
|
||||
context -> FirPropertySymbol <local>/i
|
||||
anchor -> [FirPropertySymbol <local>/$$result]
|
||||
|
||||
@R|foo/Anno|(position = <strcat>(String(local type ), R|foo/constant|)) kotlin/Int
|
||||
context -> FirBackingFieldSymbol <local>/field from FirPropertySymbol <local>/i
|
||||
anchor -> [FirPropertySymbol <local>/$$result]
|
||||
|
||||
FILE: [ResolvedTo(IMPORTS)] resultBodyAnnotation.kts
|
||||
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||
SCRIPT: [ResolvedTo(TYPES)] <script-resultBodyAnnotation.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=foo/Anno.position] position: R|kotlin/String|): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val position: R|kotlin/String| = R|<local>/position|
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
|
||||
public final const [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val constant: R|kotlin/Int| = Int(0)
|
||||
public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): R|kotlin/Int|
|
||||
|
||||
public final [ResolvedTo(CONTRACTS)] fun foo([ResolvedTo(CONTRACTS)] action: R|() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final [ResolvedTo(BODY_RESOLVE)] val $$result: R|kotlin/Unit| = @R|foo/Anno|[Types](position = <strcat>(String(call ), R|foo/constant|)) R|foo/foo|(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0<kotlin/Unit>] foo@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/constant|)) [ResolvedTo(BODY_RESOLVE)] lval i: R|@R|foo/Anno|(position = <strcat>(String(local type ), R|foo/constant|)) kotlin/Int|
|
||||
}
|
||||
)
|
||||
public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Unit|
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// RESOLVE_SCRIPT
|
||||
// BODY_RESOLVE
|
||||
// MEMBER_NAME_FILTER: $$result
|
||||
|
||||
package foo
|
||||
|
||||
annotation class Anno(val position: String)
|
||||
const val constant = 0
|
||||
|
||||
fun foo(action: () -> Unit) {}
|
||||
|
||||
@Anno("call $constant")
|
||||
foo {
|
||||
@Anno("property $constant")
|
||||
val i: @Anno("local type $constant") Int
|
||||
}
|
||||
+339
@@ -0,0 +1,339 @@
|
||||
RAW_FIR:
|
||||
FILE: [ResolvedTo(RAW_FIR)] resultBodyAnnotation.kts
|
||||
context(<script>@kotlin.script.templates.standard.ScriptTemplateWithArgs)
|
||||
SCRIPT: [ResolvedTo(RAW_FIR)] <script-resultBodyAnnotation.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public final? [ResolvedTo(RAW_FIR)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=foo/Anno.position] position: String): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val position: String = R|<local>/position|
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String
|
||||
|
||||
}
|
||||
|
||||
public? final? const [ResolvedTo(RAW_FIR)] val constant: <implicit> = LAZY_EXPRESSION
|
||||
public? [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] action: ( () -> Unit )): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
public final [ResolvedTo(RAW_FIR)] val $$result: <implicit> = @Anno[Unresolved](LAZY_EXPRESSION) foo#(<L> = LAZY_EXPRESSION)
|
||||
public [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
|
||||
|
||||
IMPORTS:
|
||||
FILE: [ResolvedTo(IMPORTS)] resultBodyAnnotation.kts
|
||||
context(<script>@kotlin.script.templates.standard.ScriptTemplateWithArgs)
|
||||
SCRIPT: [ResolvedTo(RAW_FIR)] <script-resultBodyAnnotation.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public final? [ResolvedTo(RAW_FIR)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=foo/Anno.position] position: String): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val position: String = R|<local>/position|
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String
|
||||
|
||||
}
|
||||
|
||||
public? final? const [ResolvedTo(RAW_FIR)] val constant: <implicit> = LAZY_EXPRESSION
|
||||
public? [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] action: ( () -> Unit )): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
public final [ResolvedTo(RAW_FIR)] val $$result: <implicit> = @Anno[Unresolved](LAZY_EXPRESSION) foo#(<L> = LAZY_EXPRESSION)
|
||||
public [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
|
||||
|
||||
COMPILER_REQUIRED_ANNOTATIONS:
|
||||
FILE: [ResolvedTo(IMPORTS)] resultBodyAnnotation.kts
|
||||
context(<script>@kotlin.script.templates.standard.ScriptTemplateWithArgs)
|
||||
SCRIPT: [ResolvedTo(RAW_FIR)] <script-resultBodyAnnotation.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public final? [ResolvedTo(RAW_FIR)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=foo/Anno.position] position: String): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val position: String = R|<local>/position|
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String
|
||||
|
||||
}
|
||||
|
||||
public? final? const [ResolvedTo(RAW_FIR)] val constant: <implicit> = LAZY_EXPRESSION
|
||||
public? [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] action: ( () -> Unit )): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
public final [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] val $$result: <implicit> = @Anno[Unresolved](LAZY_EXPRESSION) foo#(<L> = LAZY_EXPRESSION)
|
||||
public [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] get(): <implicit>
|
||||
|
||||
|
||||
COMPANION_GENERATION:
|
||||
FILE: [ResolvedTo(IMPORTS)] resultBodyAnnotation.kts
|
||||
context(<script>@kotlin.script.templates.standard.ScriptTemplateWithArgs)
|
||||
SCRIPT: [ResolvedTo(RAW_FIR)] <script-resultBodyAnnotation.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public final? [ResolvedTo(RAW_FIR)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=foo/Anno.position] position: String): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val position: String = R|<local>/position|
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String
|
||||
|
||||
}
|
||||
|
||||
public? final? const [ResolvedTo(RAW_FIR)] val constant: <implicit> = LAZY_EXPRESSION
|
||||
public? [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] action: ( () -> Unit )): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
public final [ResolvedTo(COMPANION_GENERATION)] val $$result: <implicit> = @Anno[Unresolved](LAZY_EXPRESSION) foo#(<L> = LAZY_EXPRESSION)
|
||||
public [ResolvedTo(COMPANION_GENERATION)] get(): <implicit>
|
||||
|
||||
|
||||
SUPER_TYPES:
|
||||
FILE: [ResolvedTo(IMPORTS)] resultBodyAnnotation.kts
|
||||
context(<script>@kotlin.script.templates.standard.ScriptTemplateWithArgs)
|
||||
SCRIPT: [ResolvedTo(RAW_FIR)] <script-resultBodyAnnotation.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public final? [ResolvedTo(RAW_FIR)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=foo/Anno.position] position: String): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val position: String = R|<local>/position|
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String
|
||||
|
||||
}
|
||||
|
||||
public? final? const [ResolvedTo(RAW_FIR)] val constant: <implicit> = LAZY_EXPRESSION
|
||||
public? [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] action: ( () -> Unit )): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
public final [ResolvedTo(SUPER_TYPES)] val $$result: <implicit> = @Anno[Unresolved](LAZY_EXPRESSION) foo#(<L> = LAZY_EXPRESSION)
|
||||
public [ResolvedTo(SUPER_TYPES)] get(): <implicit>
|
||||
|
||||
|
||||
TYPES:
|
||||
FILE: [ResolvedTo(IMPORTS)] resultBodyAnnotation.kts
|
||||
context(<script>@kotlin.script.templates.standard.ScriptTemplateWithArgs)
|
||||
SCRIPT: [ResolvedTo(RAW_FIR)] <script-resultBodyAnnotation.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public final? [ResolvedTo(RAW_FIR)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=foo/Anno.position] position: String): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val position: String = R|<local>/position|
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String
|
||||
|
||||
}
|
||||
|
||||
public? final? const [ResolvedTo(RAW_FIR)] val constant: <implicit> = LAZY_EXPRESSION
|
||||
public? [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] action: ( () -> Unit )): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
public final [ResolvedTo(TYPES)] val $$result: <implicit> = @Anno[Unresolved](LAZY_EXPRESSION) foo#(<L> = LAZY_EXPRESSION)
|
||||
public [ResolvedTo(TYPES)] get(): <implicit>
|
||||
|
||||
|
||||
STATUS:
|
||||
FILE: [ResolvedTo(IMPORTS)] resultBodyAnnotation.kts
|
||||
context(<script>@kotlin.script.templates.standard.ScriptTemplateWithArgs)
|
||||
SCRIPT: [ResolvedTo(RAW_FIR)] <script-resultBodyAnnotation.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public final? [ResolvedTo(RAW_FIR)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=foo/Anno.position] position: String): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val position: String = R|<local>/position|
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String
|
||||
|
||||
}
|
||||
|
||||
public? final? const [ResolvedTo(RAW_FIR)] val constant: <implicit> = LAZY_EXPRESSION
|
||||
public? [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] action: ( () -> Unit )): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
public final [ResolvedTo(STATUS)] val $$result: <implicit> = @Anno[Unresolved](LAZY_EXPRESSION) foo#(<L> = LAZY_EXPRESSION)
|
||||
public [ResolvedTo(STATUS)] get(): <implicit>
|
||||
|
||||
|
||||
EXPECT_ACTUAL_MATCHING:
|
||||
FILE: [ResolvedTo(IMPORTS)] resultBodyAnnotation.kts
|
||||
context(<script>@kotlin.script.templates.standard.ScriptTemplateWithArgs)
|
||||
SCRIPT: [ResolvedTo(RAW_FIR)] <script-resultBodyAnnotation.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public final? [ResolvedTo(RAW_FIR)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=foo/Anno.position] position: String): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val position: String = R|<local>/position|
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String
|
||||
|
||||
}
|
||||
|
||||
public? final? const [ResolvedTo(RAW_FIR)] val constant: <implicit> = LAZY_EXPRESSION
|
||||
public? [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] action: ( () -> Unit )): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] val $$result: <implicit> = @Anno[Unresolved](LAZY_EXPRESSION) foo#(<L> = LAZY_EXPRESSION)
|
||||
public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] get(): <implicit>
|
||||
|
||||
|
||||
CONTRACTS:
|
||||
FILE: [ResolvedTo(IMPORTS)] resultBodyAnnotation.kts
|
||||
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||
SCRIPT: [ResolvedTo(TYPES)] <script-resultBodyAnnotation.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public final? [ResolvedTo(RAW_FIR)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=foo/Anno.position] position: String): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val position: String = R|<local>/position|
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String
|
||||
|
||||
}
|
||||
|
||||
public? final? const [ResolvedTo(RAW_FIR)] val constant: <implicit> = LAZY_EXPRESSION
|
||||
public? [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] action: ( () -> Unit )): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
public final [ResolvedTo(CONTRACTS)] val $$result: <implicit> = @Anno[Unresolved](LAZY_EXPRESSION) foo#(<L> = LAZY_EXPRESSION)
|
||||
public [ResolvedTo(CONTRACTS)] get(): <implicit>
|
||||
|
||||
|
||||
IMPLICIT_TYPES_BODY_RESOLVE:
|
||||
FILE: [ResolvedTo(IMPORTS)] resultBodyAnnotation.kts
|
||||
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||
SCRIPT: [ResolvedTo(TYPES)] <script-resultBodyAnnotation.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=foo/Anno.position] position: R|kotlin/String|): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val position: R|kotlin/String| = R|<local>/position|
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
|
||||
public final const [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val constant: R|kotlin/Int| = Int(0)
|
||||
public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): R|kotlin/Int|
|
||||
|
||||
public final [ResolvedTo(CONTRACTS)] fun foo([ResolvedTo(CONTRACTS)] action: R|() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val $$result: R|kotlin/Unit| = @R|foo/Anno|[Types](position = <strcat>(String(call ), R|foo/constant|)) R|foo/foo|(<L> = [ResolvedTo(RAW_FIR)] [MatchingParameterFunctionTypeKey=kotlin/Function0<kotlin/Unit>] foo@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/constant|)) [ResolvedTo(RAW_FIR)] lval i: R|@R|foo/Anno|(position = <strcat>(String(local type ), R|foo/constant|)) kotlin/Int|
|
||||
}
|
||||
)
|
||||
public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): R|kotlin/Unit|
|
||||
|
||||
|
||||
ANNOTATION_ARGUMENTS:
|
||||
FILE: [ResolvedTo(IMPORTS)] resultBodyAnnotation.kts
|
||||
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||
SCRIPT: [ResolvedTo(TYPES)] <script-resultBodyAnnotation.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=foo/Anno.position] position: R|kotlin/String|): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val position: R|kotlin/String| = R|<local>/position|
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
|
||||
public final const [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val constant: R|kotlin/Int| = Int(0)
|
||||
public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): R|kotlin/Int|
|
||||
|
||||
public final [ResolvedTo(CONTRACTS)] fun foo([ResolvedTo(CONTRACTS)] action: R|() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final [ResolvedTo(ANNOTATION_ARGUMENTS)] val $$result: R|kotlin/Unit| = @R|foo/Anno|[Types](position = <strcat>(String(call ), R|foo/constant|)) R|foo/foo|(<L> = [ResolvedTo(RAW_FIR)] [MatchingParameterFunctionTypeKey=kotlin/Function0<kotlin/Unit>] foo@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/constant|)) [ResolvedTo(RAW_FIR)] lval i: R|@R|foo/Anno|(position = <strcat>(String(local type ), R|foo/constant|)) kotlin/Int|
|
||||
}
|
||||
)
|
||||
public [ResolvedTo(ANNOTATION_ARGUMENTS)] get(): R|kotlin/Unit|
|
||||
|
||||
|
||||
BODY_RESOLVE:
|
||||
FILE: [ResolvedTo(IMPORTS)] resultBodyAnnotation.kts
|
||||
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||
SCRIPT: [ResolvedTo(TYPES)] <script-resultBodyAnnotation.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=foo/Anno.position] position: R|kotlin/String|): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val position: R|kotlin/String| = R|<local>/position|
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
|
||||
public final const [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val constant: R|kotlin/Int| = Int(0)
|
||||
public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): R|kotlin/Int|
|
||||
|
||||
public final [ResolvedTo(CONTRACTS)] fun foo([ResolvedTo(CONTRACTS)] action: R|() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final [ResolvedTo(BODY_RESOLVE)] val $$result: R|kotlin/Unit| = @R|foo/Anno|[Types](position = <strcat>(String(call ), R|foo/constant|)) R|foo/foo|(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0<kotlin/Unit>] foo@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/constant|)) [ResolvedTo(BODY_RESOLVE)] lval i: R|@R|foo/Anno|(position = <strcat>(String(local type ), R|foo/constant|)) kotlin/Int|
|
||||
}
|
||||
)
|
||||
public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Unit|
|
||||
|
||||
|
||||
FILE RAW TO BODY:
|
||||
FILE: [ResolvedTo(BODY_RESOLVE)] resultBodyAnnotation.kts
|
||||
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||
SCRIPT: [ResolvedTo(BODY_RESOLVE)] <script-resultBodyAnnotation.kts>
|
||||
[ResolvedTo(BODY_RESOLVE)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public final [ResolvedTo(BODY_RESOLVE)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Anno] constructor([ResolvedTo(BODY_RESOLVE)] [CorrespondingProperty=foo/Anno.position] position: R|kotlin/String|): R|foo/Anno| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final [ResolvedTo(BODY_RESOLVE)] [IsFromPrimaryConstructor=true] val position: R|kotlin/String| = R|<local>/position|
|
||||
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Anno] get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
|
||||
public final const [ResolvedTo(BODY_RESOLVE)] val constant: R|kotlin/Int| = Int(0)
|
||||
public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int|
|
||||
|
||||
public final [ResolvedTo(BODY_RESOLVE)] fun foo([ResolvedTo(BODY_RESOLVE)] action: R|() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final [ResolvedTo(BODY_RESOLVE)] val $$result: R|kotlin/Unit| = @R|foo/Anno|[Types](position = <strcat>(String(call ), R|foo/constant|)) R|foo/foo|(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0<kotlin/Unit>] foo@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/constant|)) [ResolvedTo(BODY_RESOLVE)] lval i: R|@R|foo/Anno|(position = <strcat>(String(local type ), R|foo/constant|)) kotlin/Int|
|
||||
}
|
||||
)
|
||||
public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Unit|
|
||||
+6
@@ -631,6 +631,12 @@ public class ScriptLazyDeclarationResolveForTypeAnnotationsTestGenerated extends
|
||||
runTest("analysis/low-level-api-fir/testData/lazyResolveTypeAnnotations/property/receiverAsImplicitReturnTypeScript.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resultBodyAnnotation.kts")
|
||||
public void testResultBodyAnnotation() {
|
||||
runTest("analysis/low-level-api-fir/testData/lazyResolveTypeAnnotations/property/resultBodyAnnotation.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resultWithPropagatedType.kts")
|
||||
public void testResultWithPropagatedType() {
|
||||
|
||||
+6
@@ -631,6 +631,12 @@ public class ScriptLazyTypeAnnotationsTestGenerated extends AbstractScriptLazyTy
|
||||
runTest("analysis/low-level-api-fir/testData/lazyResolveTypeAnnotations/property/receiverAsImplicitReturnTypeScript.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resultBodyAnnotation.kts")
|
||||
public void testResultBodyAnnotation() {
|
||||
runTest("analysis/low-level-api-fir/testData/lazyResolveTypeAnnotations/property/resultBodyAnnotation.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resultWithPropagatedType.kts")
|
||||
public void testResultWithPropagatedType() {
|
||||
|
||||
+6
@@ -34236,6 +34236,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/script/SimpleScript.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SuppressAnnoInLastExpression.kts")
|
||||
public void testSuppressAnnoInLastExpression() {
|
||||
runTest("compiler/testData/diagnostics/tests/script/SuppressAnnoInLastExpression.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelInlineFun.kts")
|
||||
public void testTopLevelInlineFun() {
|
||||
|
||||
+6
@@ -34236,6 +34236,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/script/SimpleScript.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SuppressAnnoInLastExpression.kts")
|
||||
public void testSuppressAnnoInLastExpression() {
|
||||
runTest("compiler/testData/diagnostics/tests/script/SuppressAnnoInLastExpression.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelInlineFun.kts")
|
||||
public void testTopLevelInlineFun() {
|
||||
|
||||
+6
@@ -31976,6 +31976,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/script/SimpleScript.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SuppressAnnoInLastExpression.kts")
|
||||
public void testSuppressAnnoInLastExpression() {
|
||||
runTest("compiler/testData/diagnostics/tests/script/SuppressAnnoInLastExpression.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelInlineFun.kts")
|
||||
public void testTopLevelInlineFun() {
|
||||
|
||||
+13
-1
@@ -1305,6 +1305,9 @@ open class PsiRawFirBuilder(
|
||||
// the last one need to be analyzed in script configurator to decide on result property
|
||||
// therefore no lazy conversion in this case
|
||||
allowLazyBody = !isLast,
|
||||
// the last anonymous initializer could be converted to a property and its symbol will be dropped
|
||||
// therefore we should not rely on it as a containing declaration symbol, and use the parent one instead
|
||||
isLocal = isLast,
|
||||
)
|
||||
|
||||
declarations.add(initializer)
|
||||
@@ -2212,12 +2215,21 @@ open class PsiRawFirBuilder(
|
||||
return buildAnonymousInitializer(initializer, containingDeclarationSymbol = null)
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds [FirAnonymousInitializer] from [KtAnonymousInitializer]
|
||||
*
|
||||
* @param initializer Source [KtAnonymousInitializer]
|
||||
* @param containingDeclarationSymbol containing declaration symbol, if any
|
||||
* @param allowLazyBody if `true`, [FirLazyBlock] is used in the IDE mode
|
||||
* @param isLocal if `true`, the initializer is not used as a containing declaration for the contents of the initializer
|
||||
*/
|
||||
protected fun buildAnonymousInitializer(
|
||||
initializer: KtAnonymousInitializer,
|
||||
containingDeclarationSymbol: FirBasedSymbol<*>?,
|
||||
allowLazyBody: Boolean = true,
|
||||
isLocal: Boolean = false,
|
||||
) = buildAnonymousInitializer {
|
||||
withContainerSymbol(symbol) {
|
||||
withContainerSymbol(symbol, isLocal) {
|
||||
source = initializer.toFirSourceElement()
|
||||
moduleData = baseModuleData
|
||||
origin = FirDeclarationOrigin.Source
|
||||
|
||||
+6
-6
@@ -1,23 +1,23 @@
|
||||
@DestrAnno(<strcat>(String(destr 1 ), prop#))
|
||||
owner -> FirAnonymousInitializerSymbol <init>
|
||||
owner -> FirScriptSymbol util.<script-scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts>
|
||||
context -> FirPropertySymbol <local>/<destruct> from FirAnonymousInitializerSymbol <init> from FirScriptSymbol util.<script-scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts> from FirFileSymbol scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts
|
||||
|
||||
@LeftAnno(<strcat>(String(a ), prop#))
|
||||
owner -> FirAnonymousInitializerSymbol <init>
|
||||
owner -> FirScriptSymbol util.<script-scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts>
|
||||
context -> FirPropertySymbol <local>/a from FirAnonymousInitializerSymbol <init> from FirScriptSymbol util.<script-scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts> from FirFileSymbol scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts
|
||||
|
||||
@RightAnno(<strcat>(String(b ), prop#))
|
||||
owner -> FirAnonymousInitializerSymbol <init>
|
||||
owner -> FirScriptSymbol util.<script-scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts>
|
||||
context -> FirPropertySymbol <local>/b from FirAnonymousInitializerSymbol <init> from FirScriptSymbol util.<script-scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts> from FirFileSymbol scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts
|
||||
|
||||
@Destr2Anno(<strcat>(String(destr 1 ), prop#))
|
||||
owner -> FirAnonymousInitializerSymbol <init>
|
||||
owner -> FirScriptSymbol util.<script-scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts>
|
||||
context -> FirPropertySymbol <local>/<destruct> from FirAnonymousInitializerSymbol <init> from FirScriptSymbol util.<script-scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts> from FirFileSymbol scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts
|
||||
|
||||
@SecondLeftAnno(<strcat>(String(c ), prop#))
|
||||
owner -> FirAnonymousInitializerSymbol <init>
|
||||
owner -> FirScriptSymbol util.<script-scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts>
|
||||
context -> FirPropertySymbol <local>/c from FirAnonymousInitializerSymbol <init> from FirScriptSymbol util.<script-scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts> from FirFileSymbol scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts
|
||||
|
||||
@SecondRightAnno(<strcat>(String(d ), prop#))
|
||||
owner -> FirAnonymousInitializerSymbol <init>
|
||||
owner -> FirScriptSymbol util.<script-scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts>
|
||||
context -> FirPropertySymbol <local>/d from FirAnonymousInitializerSymbol <init> from FirScriptSymbol util.<script-scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts> from FirFileSymbol scriptStatementLevelDestructuringWithAnnotationAsLastStatement.kts
|
||||
@@ -0,0 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
java.io.File(".").list() as? Array<String>
|
||||
Generated
+6
@@ -34236,6 +34236,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/script/SimpleScript.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SuppressAnnoInLastExpression.kts")
|
||||
public void testSuppressAnnoInLastExpression() {
|
||||
runTest("compiler/testData/diagnostics/tests/script/SuppressAnnoInLastExpression.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelInlineFun.kts")
|
||||
public void testTopLevelInlineFun() {
|
||||
|
||||
Reference in New Issue
Block a user