[LL FIR] drop granular resolve from scripts

Effectively, KtScript currently resolves as a monolith,
so we have problems because some declarations have
their own locks, but some others are not
This change fixed many exceptions

^KT-60728
This commit is contained in:
Dmitrii Gridin
2023-07-26 20:24:04 +02:00
committed by Space Team
parent e248d1a588
commit c79bdd8ce3
4 changed files with 25 additions and 24 deletions
@@ -263,7 +263,8 @@ internal fun PsiElement.getNonLocalContainingOrThisDeclaration(predicate: (KtDec
!notNullCandidate.isPartOf(parent) ||
parent is KtClassInitializer ||
parent is KtObjectLiteralExpression ||
parent is KtCallElement
parent is KtCallElement ||
parent is KtScript
) {
// Candidate turned out to be local. Let's find another one.
candidate = null
@@ -1,16 +1,16 @@
/* anchor --> *//* anchor --> */class A /* anchor --> */constructor(/* anchor --> */a: Int/* <-- */)/* <-- */ {
/* anchor --> */fun boo() {
/* anchor --> */class A constructor(a: Int) {
fun boo() {
fun bar() {
}
}/* <-- */
}
/* anchor --> */val i: Int = 42/* <-- */
val i: Int = 42
/* anchor --> */init {
init {
fun foo() {
}
}/* <-- */
}/* <-- */
/* <-- */
}
}
/* <-- */
@@ -1,18 +1,18 @@
package one/* anchor --> */
/* anchor --> */class A /* anchor --> */constructor(/* anchor --> */a: Int/* <-- */)/* <-- */ {
/* anchor --> */fun boo() {
class A constructor(a: Int) {
fun boo() {
fun bar() {
}
}/* <-- */
}
/* anchor --> */val i: Int = 42/* <-- */
val i: Int = 42
/* anchor --> */init {
init {
fun foo() {
}
}/* <-- */
}/* <-- */
/* <-- */
}
}
/* <-- */
@@ -1,12 +1,12 @@
/* anchor --> *//* anchor --> */class Builder {
/* anchor --> */var version: String = ""/* <-- */
/* anchor --> */class Builder {
var version: String = ""
/* anchor --> */fun execute() {
fun execute() {
println(version)
}/* <-- */
}/* <-- */
}
}
fun build(/* anchor --> */action: Builder.() -> Unit/* <-- */) = Builder().apply(action)
fun build(action: Builder.() -> Unit) = Builder().apply(action)
build {
version = "123"
@@ -24,4 +24,4 @@ val builder = build {
}
builder.execute()
/* <-- */
/* <-- */