[FIR] Properly assign <local> packages to symbols
This prevents `FirConflictsExpressionChecker.kt` from missing conflicting local functions. It used to due to inconsistencies in assigning `<local>`, and this commit makes it a bit more straightforward. The change in KtClassTypeQualifierRenderer prevents `FirOverrideImplementTest.testLocalClass` from failing in `intellij`. It didn't fail for callables, because `KtCallableSignatureRenderer` doesn't try to render packages. ^KT-59186 Fixed
This commit is contained in:
committed by
Space Team
parent
cf655fd5ad
commit
f9c6af4d2a
@@ -5,14 +5,14 @@ FILE: kt53819.kt
|
||||
private get(): R|kotlin/Int|
|
||||
private set(value: R|kotlin/Int|): R|kotlin/Unit|
|
||||
|
||||
public constructor(x: R|kotlin/Int|): R|Foo| {
|
||||
public constructor(x: R|kotlin/Int|): R|<local>/Foo| {
|
||||
super<R|kotlin/Any|>()
|
||||
this@R|/Foo|.R|<local>/_x| = R|<local>/x|
|
||||
this@R|<local>/Foo|.R|<local>/_x| = R|<local>/x|
|
||||
}
|
||||
|
||||
public final val x: R|kotlin/Int|
|
||||
public get(): R|kotlin/Int| {
|
||||
^ this@R|/Foo|.R|<local>/_x|
|
||||
^ this@R|<local>/Foo|.R|<local>/_x|
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ FILE: annotatedLocalClass.kt
|
||||
}
|
||||
|
||||
@R|Ann|() local final class Local : R|kotlin/Any| {
|
||||
public constructor(): R|Local| {
|
||||
public constructor(): R|<local>/Local| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ FILE: innerClassInAnonymousObject.kt
|
||||
}
|
||||
|
||||
local final class Nested : R|kotlin/Any| {
|
||||
public constructor(): R|<anonymous>.Nested| {
|
||||
public constructor(): R|<local>/<anonymous>.Nested| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -239,7 +239,7 @@ digraph localClassesWithImplicit_kt {
|
||||
115 [label="Access variable R|<local>/a|"];
|
||||
116 [label="Smart cast: R|<local>/a|"];
|
||||
117 [label="Access variable R|kotlin/String.length|"];
|
||||
118 [label="Function call: this@R|/A|.R|<local>/baz|()" style="filled" fillcolor=yellow];
|
||||
118 [label="Function call: this@R|<local>/A|.R|<local>/baz|()" style="filled" fillcolor=yellow];
|
||||
119 [label="Exit block"];
|
||||
}
|
||||
120 [label="Exit function <anonymous>" style="filled" fillcolor=red];
|
||||
@@ -249,7 +249,7 @@ digraph localClassesWithImplicit_kt {
|
||||
123 [label="Jump: ^bar R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| <inline=Inline, kind=UNKNOWN> {
|
||||
R|<local>/b|.<Unresolved name: length>#
|
||||
R|<local>/a|.R|kotlin/String.length|
|
||||
^ this@R|/A|.R|<local>/baz|()
|
||||
^ this@R|<local>/A|.R|<local>/baz|()
|
||||
}
|
||||
)"];
|
||||
124 [label="Stub" style="filled" fillcolor=gray];
|
||||
@@ -303,7 +303,7 @@ digraph localClassesWithImplicit_kt {
|
||||
149 [label="Access variable R|<local>/b|"];
|
||||
150 [label="Smart cast: R|<local>/b|"];
|
||||
151 [label="Access variable R|kotlin/String.length|"];
|
||||
152 [label="Function call: this@R|/A|.R|<local>/bar|()" style="filled" fillcolor=yellow];
|
||||
152 [label="Function call: this@R|<local>/A|.R|<local>/bar|()" style="filled" fillcolor=yellow];
|
||||
153 [label="Exit block"];
|
||||
}
|
||||
154 [label="Exit when branch result"];
|
||||
@@ -320,7 +320,7 @@ digraph localClassesWithImplicit_kt {
|
||||
^ when () {
|
||||
(R|<local>/b| is R|kotlin/String|) -> {
|
||||
R|<local>/b|.R|kotlin/String.length|
|
||||
this@R|/A|.R|<local>/bar|()
|
||||
this@R|<local>/A|.R|<local>/bar|()
|
||||
}
|
||||
else -> {
|
||||
Int(1)
|
||||
|
||||
+3
-3
@@ -10,7 +10,7 @@ FILE: localClassesWithImplicit.kt
|
||||
}
|
||||
|
||||
local final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
public constructor(): R|<local>/A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ FILE: localClassesWithImplicit.kt
|
||||
^ when () {
|
||||
(R|<local>/b| is R|kotlin/String|) -> {
|
||||
R|<local>/b|.R|kotlin/String.length|
|
||||
this@R|/A|.R|<local>/bar|()
|
||||
this@R|<local>/A|.R|<local>/bar|()
|
||||
}
|
||||
else -> {
|
||||
Int(1)
|
||||
@@ -35,7 +35,7 @@ FILE: localClassesWithImplicit.kt
|
||||
^bar R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| <inline=Inline, kind=UNKNOWN> {
|
||||
R|<local>/b|.<Unresolved name: length>#
|
||||
R|<local>/a|.R|kotlin/String.length|
|
||||
^ this@R|/A|.R|<local>/baz|()
|
||||
^ this@R|<local>/A|.R|<local>/baz|()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ FILE: propertiesAndInitBlocks.kt
|
||||
}
|
||||
|
||||
local final class InitializerLocalClass : R|kotlin/Any| {
|
||||
public constructor(): R|InitializerLocalClass| {
|
||||
public constructor(): R|<local>/InitializerLocalClass| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ FILE: propertiesAndInitBlocks.kt
|
||||
)
|
||||
public get(): R|kotlin/Unit| {
|
||||
local final class GetterLocalClass : R|kotlin/Any| {
|
||||
public constructor(): R|GetterLocalClass| {
|
||||
public constructor(): R|<local>/GetterLocalClass| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -1,19 +1,19 @@
|
||||
FILE: localAnnotationClass.kt
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
local final annotation class Ann : R|kotlin/Annotation| {
|
||||
public constructor(): R|Ann| {
|
||||
public constructor(): R|<local>/Ann| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@R|Ann|() local final class Local : R|kotlin/Any| {
|
||||
public constructor(): R|Local| {
|
||||
@R|<local>/Ann|() local final class Local : R|kotlin/Any| {
|
||||
public constructor(): R|<local>/Local| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
local final annotation class Nested : R|kotlin/Annotation| {
|
||||
public constructor(): R|Local.Nested| {
|
||||
public constructor(): R|<local>/Local.Nested| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -27,12 +27,12 @@ FILE: localEntitytNotAllowed.kt
|
||||
}
|
||||
|
||||
local final object D : R|kotlin/Any| {
|
||||
private constructor(): R|A.<anonymous>.D| {
|
||||
private constructor(): R|<local>/<anonymous>.D| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
local final object G : R|kotlin/Any| {
|
||||
private constructor(): R|A.<anonymous>.D.G| {
|
||||
private constructor(): R|<local>/<anonymous>.D.G| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -52,12 +52,12 @@ FILE: localEntitytNotAllowed.kt
|
||||
|
||||
public final fun b(): R|kotlin/Unit| {
|
||||
local final object E : R|kotlin/Any| {
|
||||
private constructor(): R|A.E| {
|
||||
private constructor(): R|<local>/E| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
local final object F : R|kotlin/Any| {
|
||||
private constructor(): R|A.E.F| {
|
||||
private constructor(): R|<local>/E.F| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ FILE: sealedSupertype.kt
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
local final class L : R|P| {
|
||||
public constructor(): R|L| {
|
||||
public constructor(): R|<local>/L| {
|
||||
super<R|P|>()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ FILE: sealedSupertype.ll.kt
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
local final class L : R|P| {
|
||||
public constructor(): R|L| {
|
||||
public constructor(): R|<local>/L| {
|
||||
super<R|P|>()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ FILE: typeParametersInObject.kt
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
local final object M<H> : R|kotlin/Any| {
|
||||
private constructor<H>(): R|M<H>| {
|
||||
private constructor<H>(): R|<local>/M<H>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@ FILE: localClassAccessesContainingClass.kt
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
local final class Local : R|kotlin/Any| {
|
||||
public constructor(): R|Outer.Local| {
|
||||
public constructor(): R|<local>/Local| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
FILE: localConstructor.kt
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
local final class Local : R|kotlin/Any| {
|
||||
public constructor(): R|Local| {
|
||||
public constructor(): R|<local>/Local| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
lval l: R|Local| = R|<local>/Local.Local|()
|
||||
lval l: R|<local>/Local| = R|<local>/Local.Local|()
|
||||
}
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ FILE: localInnerClass.kt
|
||||
}
|
||||
|
||||
local final inner class Derived : R|Foo| {
|
||||
public <anonymous>.constructor(x: R|kotlin/Int|): R|<anonymous>.Derived| {
|
||||
public <anonymous>.constructor(x: R|kotlin/Int|): R|<local>/<anonymous>.Derived| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@ FILE: localObjects.kt
|
||||
|
||||
R|<local>/b|.R|/Foo.foo|()
|
||||
local final object B : R|kotlin/Any| {
|
||||
private constructor(): R|B| {
|
||||
private constructor(): R|<local>/B| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ FILE: localObjects.kt
|
||||
|
||||
}
|
||||
|
||||
Q|B|.R|<local>/foo|()
|
||||
Q|<local>/B|.R|<local>/foo|()
|
||||
}
|
||||
public final val bb: <ERROR TYPE REF: Unresolved name: foo> = <Unresolved name: B>#.<Unresolved name: foo>#()
|
||||
public get(): <ERROR TYPE REF: Unresolved name: foo>
|
||||
|
||||
+6
-6
@@ -10,7 +10,7 @@ FILE: localScopes.kt
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
local open class BaseLocal : R|Bar| {
|
||||
public constructor(): R|BaseLocal| {
|
||||
public constructor(): R|<local>/BaseLocal| {
|
||||
super<R|Bar|>()
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ FILE: localScopes.kt
|
||||
|
||||
}
|
||||
|
||||
lval base: R|BaseLocal| = R|<local>/BaseLocal.BaseLocal|()
|
||||
lval base: R|<local>/BaseLocal| = R|<local>/BaseLocal.BaseLocal|()
|
||||
R|<local>/base|.R|<local>/baz|()
|
||||
R|<local>/base|.R|/Bar.foo|()
|
||||
lval anonymous: R|<anonymous>| = object : R|Bar| {
|
||||
@@ -34,9 +34,9 @@ FILE: localScopes.kt
|
||||
|
||||
R|<local>/anonymous|.R|/<anonymous>.baz|()
|
||||
R|<local>/anonymous|.R|/Bar.foo|()
|
||||
local final class DerivedLocal : R|BaseLocal| {
|
||||
public constructor(): R|DerivedLocal| {
|
||||
super<R|BaseLocal|>()
|
||||
local final class DerivedLocal : R|<local>/BaseLocal| {
|
||||
public constructor(): R|<local>/DerivedLocal| {
|
||||
super<R|<local>/BaseLocal|>()
|
||||
}
|
||||
|
||||
public final fun gau(): R|kotlin/Unit| {
|
||||
@@ -44,7 +44,7 @@ FILE: localScopes.kt
|
||||
|
||||
}
|
||||
|
||||
lval derived: R|DerivedLocal| = R|<local>/DerivedLocal.DerivedLocal|()
|
||||
lval derived: R|<local>/DerivedLocal| = R|<local>/DerivedLocal.DerivedLocal|()
|
||||
R|<local>/derived|.R|<local>/gau|()
|
||||
R|<local>/derived|.R|<local>/baz|()
|
||||
R|<local>/derived|.R|/Bar.foo|()
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ FILE: localTypes.kt
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Int| = Int(1)
|
||||
local final class Bar : R|Foo| {
|
||||
public constructor(): R|Bar| {
|
||||
public constructor(): R|<local>/Bar| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -64,24 +64,24 @@ FILE: first.kt
|
||||
}
|
||||
public final fun withLocals(): R|kotlin/Unit| {
|
||||
local final class Local : R|kotlin/Any| {
|
||||
public constructor(): R|Local| {
|
||||
public constructor(): R|<local>/Local| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
private final fun bar(): R|kotlin/Unit|
|
||||
|
||||
public final fun baz(): R|kotlin/Unit| {
|
||||
this@R|/Local|.R|<local>/bar|()
|
||||
this@R|/Local|.R|<local>/Local.Inner.Inner|()
|
||||
this@R|<local>/Local|.R|<local>/bar|()
|
||||
this@R|<local>/Local|.R|<local>/Local.Inner.Inner|()
|
||||
}
|
||||
|
||||
local final inner class Inner : R|kotlin/Any| {
|
||||
public Local.constructor(): R|Local.Inner| {
|
||||
public <local>/Local.constructor(): R|<local>/Local.Inner| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
this@R|/Local|.R|<local>/bar|()
|
||||
this@R|<local>/Local|.R|<local>/bar|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ FILE: RedundantVisibilityModifierChecker.kt
|
||||
public final fun f(): R|kotlin/Unit| {
|
||||
lvar baz: R|kotlin/Int| = Int(0)
|
||||
local final class LocalClass : R|kotlin/Any| {
|
||||
public constructor(): R|LocalClass| {
|
||||
public constructor(): R|<local>/LocalClass| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
FILE: RedundantVisibilityModifierCheckerWithExplicitApiMode.kt
|
||||
public final fun f1(): R|kotlin/Unit| {
|
||||
local final class LocalClass : R|kotlin/Any| {
|
||||
public constructor(): R|LocalClass| {
|
||||
public constructor(): R|<local>/LocalClass| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ FILE: localVariable.kt
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
local final class Local : R|kotlin/Any| {
|
||||
public constructor(): R|Outer.Local| {
|
||||
public constructor(): R|<local>/Local| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -2,15 +2,15 @@ FILE: localVariableInSecondaryConstructor.kt
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
lval localVariable: R|kotlin/Int| = Int(0)
|
||||
local final class LocalClass : R|kotlin/Any| {
|
||||
public constructor(arg: R|kotlin/Int|): R|LocalClass| {
|
||||
public constructor(arg: R|kotlin/Int|): R|<local>/LocalClass| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val arg: R|kotlin/Int| = R|<local>/arg|
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
public constructor(): R|LocalClass| {
|
||||
this<R|LocalClass|>(R|<local>/localVariable|)
|
||||
public constructor(): R|<local>/LocalClass| {
|
||||
this<R|<local>/LocalClass|>(R|<local>/localVariable|)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -4,7 +4,7 @@ FILE: callableReferenceToLocalClass.kt
|
||||
}
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
local final class Data : R|kotlin/Any| {
|
||||
public constructor(x: R|kotlin/Int|): R|Data| {
|
||||
public constructor(x: R|kotlin/Int|): R|<local>/Data| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ FILE: callableReferenceToLocalClass.kt
|
||||
|
||||
}
|
||||
|
||||
lval datas: R|kotlin/collections/List<Data>| = Null(null)!!
|
||||
lval xs: R|kotlin/collections/List<kotlin/Int>| = R|<local>/datas|.R|/myMap|<R|Data|, R|kotlin/Int|>(Q|Data|::R|<local>/x|)
|
||||
lval datas: R|kotlin/collections/List<<local>/Data>| = Null(null)!!
|
||||
lval xs: R|kotlin/collections/List<kotlin/Int>| = R|<local>/datas|.R|/myMap|<R|<local>/Data|, R|kotlin/Int|>(Q|<local>/Data|::R|<local>/x|)
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ FILE: inlineClassDeclaration.kt
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
local final inline class C : R|kotlin/Any| {
|
||||
public constructor(x: R|kotlin/Int|): R|A.C| {
|
||||
public constructor(x: R|kotlin/Int|): R|<local>/C| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
+15
-15
@@ -3,71 +3,71 @@ FILE: implicitInLocalClasses.kt
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
local final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
public constructor(): R|<local>/A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun foo(x: R|kotlin/Int|): R|kotlin/Boolean| {
|
||||
^foo this@R|/A|.R|<local>/bar|(R|<local>/x|)
|
||||
^foo this@R|<local>/A|.R|<local>/bar|(R|<local>/x|)
|
||||
}
|
||||
|
||||
public final fun bar(y: R|kotlin/Int|): R|kotlin/Boolean| {
|
||||
^bar CMP(>, this@R|/A|.R|kotlin/Any.hashCode|().R|kotlin/Int.plus|(R|<local>/y|).R|kotlin/Int.compareTo|(Int(0)))
|
||||
^bar CMP(>, this@R|<local>/A|.R|kotlin/Any.hashCode|().R|kotlin/Int.plus|(R|<local>/y|).R|kotlin/Int.compareTo|(Int(0)))
|
||||
}
|
||||
|
||||
public final val w: R|kotlin/Boolean|
|
||||
public get(): R|kotlin/Boolean| {
|
||||
^ this@R|/A|.R|<local>/z|
|
||||
^ this@R|<local>/A|.R|<local>/z|
|
||||
}
|
||||
|
||||
public final val z: R|kotlin/Boolean|
|
||||
public get(): R|kotlin/Boolean| {
|
||||
^ ==(this@R|/A|.R|kotlin/Any.hashCode|(), Int(0))
|
||||
^ ==(this@R|<local>/A|.R|kotlin/Any.hashCode|(), Int(0))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
lval a: R|A| = R|<local>/A.A|()
|
||||
lval a: R|<local>/A| = R|<local>/A.A|()
|
||||
R|/useBoolean|(R|<local>/a|.R|<local>/foo|(Int(1)))
|
||||
R|/useBoolean|(R|<local>/a|.R|<local>/bar|(Int(1)))
|
||||
R|/useBoolean|(R|<local>/a|.R|<local>/w|)
|
||||
R|/useBoolean|(R|<local>/a|.R|<local>/z|)
|
||||
local final class B : R|kotlin/Any| {
|
||||
public constructor(): R|B| {
|
||||
public constructor(): R|<local>/B| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun foo(x: R|kotlin/Int|): R|kotlin/Boolean| {
|
||||
^foo this@R|/B|.R|<local>/inner|.R|<local>/w|
|
||||
^foo this@R|<local>/B|.R|<local>/inner|.R|<local>/w|
|
||||
}
|
||||
|
||||
public final fun bar(y: R|kotlin/Int|): R|kotlin/Boolean| {
|
||||
^bar CMP(>, this@R|/B|.R|kotlin/Any.hashCode|().R|kotlin/Int.plus|(R|<local>/y|).R|kotlin/Int.compareTo|(Int(0)))
|
||||
^bar CMP(>, this@R|<local>/B|.R|kotlin/Any.hashCode|().R|kotlin/Int.plus|(R|<local>/y|).R|kotlin/Int.compareTo|(Int(0)))
|
||||
}
|
||||
|
||||
public final val inner: R|B.Inner| = this@R|/B|.R|<local>/B.Inner.Inner|()
|
||||
public get(): R|B.Inner|
|
||||
public final val inner: R|<local>/B.Inner| = this@R|<local>/B|.R|<local>/B.Inner.Inner|()
|
||||
public get(): R|<local>/B.Inner|
|
||||
|
||||
local final inner class Inner : R|kotlin/Any| {
|
||||
public B.constructor(): R|B.Inner| {
|
||||
public <local>/B.constructor(): R|<local>/B.Inner| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val w: R|kotlin/Boolean|
|
||||
public get(): R|kotlin/Boolean| {
|
||||
^ this@R|/B.Inner|.R|<local>/z|
|
||||
^ this@R|<local>/B.Inner|.R|<local>/z|
|
||||
}
|
||||
|
||||
public final val z: R|kotlin/Boolean|
|
||||
public get(): R|kotlin/Boolean| {
|
||||
^ this@R|/B|.R|<local>/bar|(Int(1))
|
||||
^ this@R|<local>/B|.R|<local>/bar|(Int(1))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
lval b: R|B| = R|<local>/B.B|()
|
||||
lval b: R|<local>/B| = R|<local>/B.B|()
|
||||
R|/useBoolean|(R|<local>/b|.R|<local>/foo|(Int(1)))
|
||||
R|/useBoolean|(R|<local>/b|.R|<local>/bar|(Int(1)))
|
||||
R|/useBoolean|(R|<local>/b|.R|<local>/inner|.R|<local>/w|)
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
FILE: a.kt
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
local final class Local : R|B| {
|
||||
public constructor(): R|Local| {
|
||||
public constructor(): R|<local>/Local| {
|
||||
super<R|B|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -4,34 +4,34 @@ FILE: objectInnerClass.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
local final inner class Child : R|<anonymous>.Base| {
|
||||
public <anonymous>.constructor(property: R|B|): R|<anonymous>.Child| {
|
||||
this@R|/<anonymous>|.super<R|<anonymous>.Base|>(R|<local>/property|)
|
||||
local final inner class Child : R|<local>/<anonymous>.Base| {
|
||||
public <anonymous>.constructor(property: R|B|): R|<local>/<anonymous>.Child| {
|
||||
this@R|/<anonymous>|.super<R|<local>/<anonymous>.Base|>(R|<local>/property|)
|
||||
}
|
||||
|
||||
public final fun R|<anonymous>.Base|.zoo(): R|kotlin/Unit| {
|
||||
public final fun R|<local>/<anonymous>.Base|.zoo(): R|kotlin/Unit| {
|
||||
lval x: R|B| = this@R|<local>/zoo|.R|<local>/property|
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
this@R|/<anonymous>.Child|.R|<local>/baseFun|()
|
||||
lval x: R|B| = this@R|/<anonymous>.Child|.R|<local>/property|
|
||||
(this@R|/<anonymous>.Child|, this@R|/<anonymous>.Child|).R|<local>/zoo|()
|
||||
(this@R|/<anonymous>|, this@R|/<anonymous>.Child|).R|/<anonymous>.hoo|()
|
||||
this@R|<local>/<anonymous>.Child|.R|<local>/baseFun|()
|
||||
lval x: R|B| = this@R|<local>/<anonymous>.Child|.R|<local>/property|
|
||||
(this@R|<local>/<anonymous>.Child|, this@R|<local>/<anonymous>.Child|).R|<local>/zoo|()
|
||||
(this@R|/<anonymous>|, this@R|<local>/<anonymous>.Child|).R|/<anonymous>.hoo|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final fun R|<anonymous>.Child|.voo(): R|kotlin/Unit| {
|
||||
public final fun R|<local>/<anonymous>.Child|.voo(): R|kotlin/Unit| {
|
||||
lval x: R|B| = this@R|/<anonymous>.voo|.R|<local>/property|
|
||||
}
|
||||
|
||||
public final fun R|<anonymous>.Base|.hoo(): R|kotlin/Unit| {
|
||||
public final fun R|<local>/<anonymous>.Base|.hoo(): R|kotlin/Unit| {
|
||||
lval x: R|B| = this@R|/<anonymous>.hoo|.R|<local>/property|
|
||||
}
|
||||
|
||||
local open inner class Base : R|kotlin/Any| {
|
||||
public <anonymous>.constructor(property: R|B|): R|<anonymous>.Base| {
|
||||
public <anonymous>.constructor(property: R|B|): R|<local>/<anonymous>.Base| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -44,14 +44,14 @@ FILE: objectInnerClass.kt
|
||||
}
|
||||
|
||||
public final fun caseForBase(): R|kotlin/Unit| {
|
||||
lval base: R|<anonymous>.Base| = this@R|/<anonymous>|.R|<local>/<anonymous>.Base.Base|(R|/B.B|())
|
||||
lval base: R|<local>/<anonymous>.Base| = this@R|/<anonymous>|.R|<local>/<anonymous>.Base.Base|(R|/B.B|())
|
||||
R|<local>/base|.R|<local>/baseFun|()
|
||||
R|<local>/base|.R|<local>/property|
|
||||
(this@R|/<anonymous>|, R|<local>/base|).R|/<anonymous>.hoo|()
|
||||
}
|
||||
|
||||
public final fun caseForChild(): R|kotlin/Unit| {
|
||||
lval child: R|<anonymous>.Child| = this@R|/<anonymous>|.R|<local>/<anonymous>.Child.Child|(R|/B.B|())
|
||||
lval child: R|<local>/<anonymous>.Child| = this@R|/<anonymous>|.R|<local>/<anonymous>.Child.Child|(R|/B.B|())
|
||||
R|<local>/child|.R|<local>/baseFun|()
|
||||
R|<local>/child|.R|<local>/property|
|
||||
R|<local>/child|.R|<local>/foo|()
|
||||
@@ -129,34 +129,34 @@ FILE: objectInnerClass.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
local final inner class Child : R|Case3.<anonymous>.Base| {
|
||||
public <anonymous>.constructor(property: R|B|): R|Case3.<anonymous>.Child| {
|
||||
this@R|/<anonymous>|.super<R|Case3.<anonymous>.Base|>(R|<local>/property|)
|
||||
local final inner class Child : R|<local>/<anonymous>.Base| {
|
||||
public <anonymous>.constructor(property: R|B|): R|<local>/<anonymous>.Child| {
|
||||
this@R|/<anonymous>|.super<R|<local>/<anonymous>.Base|>(R|<local>/property|)
|
||||
}
|
||||
|
||||
public final fun R|Case3.<anonymous>.Base|.zoo(): R|kotlin/Unit| {
|
||||
public final fun R|<local>/<anonymous>.Base|.zoo(): R|kotlin/Unit| {
|
||||
lval x: R|B| = this@R|<local>/zoo|.R|<local>/property|
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
this@R|/Case3.<anonymous>.Child|.R|<local>/baseFun|()
|
||||
lval x: R|B| = this@R|/Case3.<anonymous>.Child|.R|<local>/property|
|
||||
(this@R|/Case3.<anonymous>.Child|, this@R|/Case3.<anonymous>.Child|).R|<local>/zoo|()
|
||||
(this@R|/<anonymous>|, this@R|/Case3.<anonymous>.Child|).R|/<anonymous>.hoo|()
|
||||
this@R|<local>/<anonymous>.Child|.R|<local>/baseFun|()
|
||||
lval x: R|B| = this@R|<local>/<anonymous>.Child|.R|<local>/property|
|
||||
(this@R|<local>/<anonymous>.Child|, this@R|<local>/<anonymous>.Child|).R|<local>/zoo|()
|
||||
(this@R|/<anonymous>|, this@R|<local>/<anonymous>.Child|).R|/<anonymous>.hoo|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final fun R|Case3.<anonymous>.Child|.voo(): R|kotlin/Unit| {
|
||||
public final fun R|<local>/<anonymous>.Child|.voo(): R|kotlin/Unit| {
|
||||
lval x: R|B| = this@R|/<anonymous>.voo|.R|<local>/property|
|
||||
}
|
||||
|
||||
public final fun R|Case3.<anonymous>.Base|.hoo(): R|kotlin/Unit| {
|
||||
public final fun R|<local>/<anonymous>.Base|.hoo(): R|kotlin/Unit| {
|
||||
lval x: R|B| = this@R|/<anonymous>.hoo|.R|<local>/property|
|
||||
}
|
||||
|
||||
local open inner class Base : R|kotlin/Any| {
|
||||
public <anonymous>.constructor(property: R|B|): R|Case3.<anonymous>.Base| {
|
||||
public <anonymous>.constructor(property: R|B|): R|<local>/<anonymous>.Base| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -169,14 +169,14 @@ FILE: objectInnerClass.kt
|
||||
}
|
||||
|
||||
public final fun caseForBase(): R|kotlin/Unit| {
|
||||
lval base: R|Case3.<anonymous>.Base| = this@R|/<anonymous>|.R|<local>/Case3.<anonymous>.Base.Base|(R|/B.B|())
|
||||
lval base: R|<local>/<anonymous>.Base| = this@R|/<anonymous>|.R|<local>/<anonymous>.Base.Base|(R|/B.B|())
|
||||
R|<local>/base|.R|<local>/baseFun|()
|
||||
R|<local>/base|.R|<local>/property|
|
||||
(this@R|/<anonymous>|, R|<local>/base|).R|/<anonymous>.hoo|()
|
||||
}
|
||||
|
||||
public final fun caseForChild(): R|kotlin/Unit| {
|
||||
lval child: R|Case3.<anonymous>.Child| = this@R|/<anonymous>|.R|<local>/Case3.<anonymous>.Child.Child|(R|/B.B|())
|
||||
lval child: R|<local>/<anonymous>.Child| = this@R|/<anonymous>|.R|<local>/<anonymous>.Child.Child|(R|/B.B|())
|
||||
R|<local>/child|.R|<local>/baseFun|()
|
||||
R|<local>/child|.R|<local>/property|
|
||||
R|<local>/child|.R|<local>/foo|()
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ FILE: test.kt
|
||||
private get(): R|kotlin/String|
|
||||
|
||||
local final inner class S : R|kotlin/Any| {
|
||||
public <anonymous>.constructor(): R|<anonymous>.S| {
|
||||
public <anonymous>.constructor(): R|<local>/<anonymous>.S| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ FILE: throwableSubclass.kt
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
local final class Test7<Outer(T), Outer(B)> : R|kotlin/Throwable| {
|
||||
public constructor(): R|Test5.Test7<T, B>| {
|
||||
public constructor(): R|<local>/Test7<T, B>| {
|
||||
super<R|kotlin/Throwable|>()
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ FILE: throwableSubclass.kt
|
||||
}
|
||||
public final fun <Z> topLevelFun(): R|kotlin/Unit| {
|
||||
local final class Test8<Outer(Z)> : R|kotlin/Error| {
|
||||
public constructor(): R|Test8<Z>| {
|
||||
public constructor(): R|<local>/Test8<Z>| {
|
||||
super<R|kotlin/Error|>()
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -27,13 +27,13 @@ FILE: inLocalClass.kt
|
||||
public final val leaked: R|kotlin/Any|
|
||||
public get(): R|kotlin/Any|
|
||||
|
||||
public constructor(): R|LocalClass| {
|
||||
public constructor(): R|<local>/LocalClass| {
|
||||
super<R|kotlin/Any|>()
|
||||
R|<local>/b|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
|
||||
}
|
||||
|
||||
init {
|
||||
this@R|/LocalClass|.R|<local>/leaked| = R|<local>/c|
|
||||
this@R|<local>/LocalClass|.R|<local>/leaked| = R|<local>/c|
|
||||
}
|
||||
|
||||
public final fun run(): R|kotlin/Unit| {
|
||||
|
||||
Vendored
+1
-1
@@ -39,7 +39,7 @@ FILE: fromLocalMembers.kt
|
||||
lval x: R|kotlin/Int|
|
||||
lval y: R|kotlin/Int|
|
||||
local final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
public constructor(): R|<local>/A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ FILE: problems.kt
|
||||
public get(): R|kotlin/Any|
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
local final class Local : R|kotlin/Any| {
|
||||
public constructor(): R|Local| {
|
||||
public constructor(): R|<local>/Local| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -10,7 +10,7 @@ FILE: FieldAnnotationWithClasses.kt
|
||||
}
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
local final class Local : R|kotlin/Any| {
|
||||
public constructor(): R|Local| {
|
||||
public constructor(): R|<local>/Local| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/localScopesInAnonymousObject.fir.txt
Vendored
+4
-4
@@ -38,7 +38,7 @@ FILE: localScopesInAnonymousObject.kt
|
||||
public get(): R|kotlin/Any|
|
||||
public final fun owner(): R|kotlin/Unit| {
|
||||
local final class Local : R|kotlin/Any| {
|
||||
public constructor(): R|Local| {
|
||||
public constructor(): R|<local>/Local| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -46,9 +46,9 @@ FILE: localScopesInAnonymousObject.kt
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
private final fun foo(): R|kotlin/Unit| {
|
||||
^foo R|kotlin/with|<R|kotlin/String|, R|kotlin/Unit|>(this@R|/Local|.R|<local>/someString|, <L> = with@fun R|kotlin/String|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
^foo R|kotlin/with|<R|kotlin/String|, R|kotlin/Unit|>(this@R|<local>/Local|.R|<local>/someString|, <L> = with@fun R|kotlin/String|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
lval presentations: R|kotlin/collections/MutableList<kotlin/String>| = R|kotlin/collections/mutableListOf|<R|kotlin/String|>()
|
||||
this@R|/Local|.R|<local>/bar|(Boolean(true))?.{ $subj$.R|kotlin/let|<R|kotlin/String|, R|kotlin/Unit|>(<L> = let@fun <anonymous>(it: R|kotlin/String|): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
this@R|<local>/Local|.R|<local>/bar|(Boolean(true))?.{ $subj$.R|kotlin/let|<R|kotlin/String|, R|kotlin/Unit|>(<L> = let@fun <anonymous>(it: R|kotlin/String|): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
R|<local>/presentations|.R|SubstitutionOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(R|<local>/it|)
|
||||
}
|
||||
) }
|
||||
@@ -57,7 +57,7 @@ FILE: localScopesInAnonymousObject.kt
|
||||
}
|
||||
|
||||
private final fun bar(arg: R|kotlin/Boolean|): R|kotlin/String?| {
|
||||
^bar R|kotlin/with|<R|kotlin/String|, R|kotlin/String?|>(this@R|/Local|.R|<local>/someString|, <L> = with@fun R|kotlin/String|.<anonymous>(): R|kotlin/String?| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
^bar R|kotlin/with|<R|kotlin/String|, R|kotlin/String?|>(this@R|<local>/Local|.R|<local>/someString|, <L> = with@fun R|kotlin/String|.<anonymous>(): R|kotlin/String?| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
^ when () {
|
||||
R|<local>/arg| -> {
|
||||
this@R|special/anonymous|
|
||||
|
||||
+19
-7
@@ -423,6 +423,8 @@ class LightTreeRawFirDeclarationBuilder(
|
||||
}
|
||||
}
|
||||
|
||||
private val LighterASTNode.isDirectlyInsideEnumEntry get() = getParent()?.getParent()?.elementType == ENUM_ENTRY
|
||||
|
||||
/***** DECLARATIONS *****/
|
||||
/**
|
||||
* @see org.jetbrains.kotlin.parsing.KotlinParsing.parseClassOrObject
|
||||
@@ -462,10 +464,12 @@ class LightTreeRawFirDeclarationBuilder(
|
||||
}
|
||||
|
||||
val className = identifier.nameAsSafeName(if (modifiers.isCompanion()) "Companion" else "")
|
||||
val isLocal = isClassLocal(classNode) { getParent() }
|
||||
val isLocalWithinParent = classNode.isDirectlyInsideEnumEntry
|
||||
|| classNode.getParent()?.elementType != CLASS_BODY && isClassLocal(classNode) { getParent() }
|
||||
val classIsExpect = modifiers.hasExpect() || context.containerIsExpect
|
||||
|
||||
return withChildClassName(className, isExpect = classIsExpect, isLocal) {
|
||||
return withChildClassName(className, isExpect = classIsExpect, isLocalWithinParent) {
|
||||
val isLocal = context.inLocalContext
|
||||
val status = FirDeclarationStatusImpl(
|
||||
if (isLocal) Visibilities.Local else modifiers.getVisibility(),
|
||||
modifiers.getModality(isClassOrObject = true)
|
||||
@@ -642,7 +646,7 @@ class LightTreeRawFirDeclarationBuilder(
|
||||
* @see org.jetbrains.kotlin.fir.builder.RawFirBuilder.Visitor.visitObjectLiteralExpression
|
||||
*/
|
||||
fun convertObjectLiteral(objectLiteral: LighterASTNode): FirElement {
|
||||
return withChildClassName(SpecialNames.ANONYMOUS, isExpect = false) {
|
||||
return withChildClassName(SpecialNames.ANONYMOUS, forceLocalContext = true, isExpect = false) {
|
||||
var delegatedFieldsMap: Map<Int, FirFieldSymbol>? = null
|
||||
buildAnonymousObjectExpression {
|
||||
source = objectLiteral.toFirSourceElement()
|
||||
@@ -998,7 +1002,9 @@ class LightTreeRawFirDeclarationBuilder(
|
||||
var firBlock: FirBlock? = null
|
||||
anonymousInitializer.forEachChildren {
|
||||
when (it.tokenType) {
|
||||
BLOCK -> firBlock = convertBlock(it)
|
||||
BLOCK -> withForcedLocalContext {
|
||||
firBlock = convertBlock(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1056,7 +1062,9 @@ class LightTreeRawFirDeclarationBuilder(
|
||||
annotations += modifiers.annotations
|
||||
typeParameters += constructorTypeParametersFromConstructedClass(classWrapper.classBuilder.typeParameters)
|
||||
valueParameters += firValueParameters.map { it.firValueParameter }
|
||||
val (body, contractDescription) = convertFunctionBody(block, null, allowLegacyContractDescription = true)
|
||||
val (body, contractDescription) = withForcedLocalContext {
|
||||
convertFunctionBody(block, null, allowLegacyContractDescription = true)
|
||||
}
|
||||
this.body = body
|
||||
contractDescription?.let { this.contractDescription = it }
|
||||
context.firFunctionTargets.removeLast()
|
||||
@@ -1501,7 +1509,9 @@ class LightTreeRawFirDeclarationBuilder(
|
||||
valueParameters += firValueParameters
|
||||
}
|
||||
val allowLegacyContractDescription = outerContractDescription == null
|
||||
val bodyWithContractDescription = convertFunctionBody(block, expression, allowLegacyContractDescription)
|
||||
val bodyWithContractDescription = withForcedLocalContext {
|
||||
convertFunctionBody(block, expression, allowLegacyContractDescription)
|
||||
}
|
||||
this.body = bodyWithContractDescription.first
|
||||
val contractDescription = outerContractDescription ?: bodyWithContractDescription.second
|
||||
contractDescription?.let {
|
||||
@@ -1768,7 +1778,9 @@ class LightTreeRawFirDeclarationBuilder(
|
||||
}
|
||||
|
||||
val allowLegacyContractDescription = outerContractDescription == null
|
||||
val bodyWithContractDescription = convertFunctionBody(block, expression, allowLegacyContractDescription)
|
||||
val bodyWithContractDescription = withForcedLocalContext {
|
||||
convertFunctionBody(block, expression, allowLegacyContractDescription)
|
||||
}
|
||||
this.body = bodyWithContractDescription.first
|
||||
val contractDescription = outerContractDescription ?: bodyWithContractDescription.second
|
||||
contractDescription?.let {
|
||||
|
||||
+25
-23
@@ -188,30 +188,32 @@ class LightTreeRawFirExpressionBuilder(
|
||||
}
|
||||
}
|
||||
|
||||
body = if (block != null) {
|
||||
declarationBuilder.convertBlockExpressionWithoutBuilding(block!!).apply {
|
||||
statements.firstOrNull()?.let {
|
||||
if (it.isContractBlockFirCheck()) {
|
||||
this@buildAnonymousFunction.contractDescription = it.toLegacyRawContractDescription()
|
||||
statements[0] = FirContractCallBlock(it)
|
||||
}
|
||||
}
|
||||
|
||||
if (statements.isEmpty()) {
|
||||
statements.add(
|
||||
buildReturnExpression {
|
||||
source = expressionSource.fakeElement(KtFakeSourceElementKind.ImplicitReturn.FromExpressionBody)
|
||||
this.target = target
|
||||
result = buildUnitExpression {
|
||||
source = expressionSource.fakeElement(KtFakeSourceElementKind.ImplicitUnit.LambdaCoercion)
|
||||
}
|
||||
body = withForcedLocalContext {
|
||||
if (block != null) {
|
||||
declarationBuilder.convertBlockExpressionWithoutBuilding(block!!).apply {
|
||||
statements.firstOrNull()?.let {
|
||||
if (it.isContractBlockFirCheck()) {
|
||||
this@buildAnonymousFunction.contractDescription = it.toLegacyRawContractDescription()
|
||||
statements[0] = FirContractCallBlock(it)
|
||||
}
|
||||
)
|
||||
}
|
||||
statements.addAll(0, destructuringStatements)
|
||||
}.build()
|
||||
} else {
|
||||
buildSingleExpressionBlock(buildErrorExpression(null, ConeSyntaxDiagnostic("Lambda has no body")))
|
||||
}
|
||||
|
||||
if (statements.isEmpty()) {
|
||||
statements.add(
|
||||
buildReturnExpression {
|
||||
source = expressionSource.fakeElement(KtFakeSourceElementKind.ImplicitReturn.FromExpressionBody)
|
||||
this.target = target
|
||||
result = buildUnitExpression {
|
||||
source = expressionSource.fakeElement(KtFakeSourceElementKind.ImplicitUnit.LambdaCoercion)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
statements.addAll(0, destructuringStatements)
|
||||
}.build()
|
||||
} else {
|
||||
buildSingleExpressionBlock(buildErrorExpression(null, ConeSyntaxDiagnostic("Lambda has no body")))
|
||||
}
|
||||
}
|
||||
context.firFunctionTargets.removeLast()
|
||||
}.also {
|
||||
|
||||
+46
-31
@@ -496,7 +496,9 @@ open class PsiRawFirBuilder(
|
||||
}
|
||||
}
|
||||
val outerContractDescription = this@toFirPropertyAccessor.obtainContractDescription()
|
||||
val (body, innerContractDescription) = this@toFirPropertyAccessor.buildFirBody()
|
||||
val (body, innerContractDescription) = withForcedLocalContext {
|
||||
this@toFirPropertyAccessor.buildFirBody()
|
||||
}
|
||||
this.body = body
|
||||
val contractDescription = outerContractDescription ?: innerContractDescription
|
||||
contractDescription?.let {
|
||||
@@ -1331,16 +1333,20 @@ open class PsiRawFirBuilder(
|
||||
}
|
||||
}
|
||||
|
||||
private val KtElement.isDirectlyInsideEnumEntry get() = parent?.parent is KtEnumEntry
|
||||
|
||||
override fun visitClassOrObject(classOrObject: KtClassOrObject, data: FirElement?): FirElement {
|
||||
// NB: enum entry nested classes are considered local by FIR design (see discussion in KT-45115)
|
||||
val isLocal = classOrObject.isLocal || classOrObject.getStrictParentOfType<KtEnumEntry>() != null
|
||||
val isLocalWithinParent = classOrObject.isDirectlyInsideEnumEntry
|
||||
|| classOrObject.parent !is KtClassBody && classOrObject.isLocal
|
||||
val classIsExpect = classOrObject.hasExpectModifier() || context.containerIsExpect
|
||||
val sourceElement = classOrObject.toFirSourceElement()
|
||||
return withChildClassName(
|
||||
classOrObject.nameAsSafeName,
|
||||
isExpect = classIsExpect,
|
||||
forceLocalContext = isLocal
|
||||
forceLocalContext = isLocalWithinParent,
|
||||
) {
|
||||
val isLocal = context.inLocalContext
|
||||
val classKind = when (classOrObject) {
|
||||
is KtObjectDeclaration -> ClassKind.OBJECT
|
||||
is KtClass -> when {
|
||||
@@ -1646,7 +1652,9 @@ open class PsiRawFirBuilder(
|
||||
listOf()
|
||||
withCapturedTypeParameters(true, functionSource, actualTypeParameters) {
|
||||
val outerContractDescription = function.obtainContractDescription()
|
||||
val (body, innerContractDescription) = function.buildFirBody()
|
||||
val (body, innerContractDescription) = withForcedLocalContext {
|
||||
function.buildFirBody()
|
||||
}
|
||||
this.body = body
|
||||
val contractDescription = outerContractDescription ?: innerContractDescription
|
||||
contractDescription?.let {
|
||||
@@ -1750,31 +1758,33 @@ open class PsiRawFirBuilder(
|
||||
context.firFunctionTargets += it
|
||||
}
|
||||
val ktBody = literal.bodyExpression
|
||||
body = if (ktBody == null) {
|
||||
val errorExpression = buildErrorExpression(source, ConeSyntaxDiagnostic("Lambda has no body"))
|
||||
FirSingleExpressionBlock(errorExpression.toReturn())
|
||||
} else {
|
||||
configureBlockWithoutBuilding(ktBody).apply {
|
||||
statements.firstOrNull()?.let {
|
||||
if (it.isContractBlockFirCheck()) {
|
||||
this@buildAnonymousFunction.contractDescription = it.toLegacyRawContractDescription()
|
||||
statements[0] = FirContractCallBlock(it)
|
||||
}
|
||||
}
|
||||
|
||||
if (statements.isEmpty()) {
|
||||
statements.add(
|
||||
buildReturnExpression {
|
||||
source = expressionSource.fakeElement(KtFakeSourceElementKind.ImplicitReturn.FromExpressionBody)
|
||||
this.target = target
|
||||
result = buildUnitExpression {
|
||||
source = expressionSource.fakeElement(KtFakeSourceElementKind.ImplicitUnit.LambdaCoercion)
|
||||
}
|
||||
body = withForcedLocalContext {
|
||||
if (ktBody == null) {
|
||||
val errorExpression = buildErrorExpression(source, ConeSyntaxDiagnostic("Lambda has no body"))
|
||||
FirSingleExpressionBlock(errorExpression.toReturn())
|
||||
} else {
|
||||
configureBlockWithoutBuilding(ktBody).apply {
|
||||
statements.firstOrNull()?.let {
|
||||
if (it.isContractBlockFirCheck()) {
|
||||
this@buildAnonymousFunction.contractDescription = it.toLegacyRawContractDescription()
|
||||
statements[0] = FirContractCallBlock(it)
|
||||
}
|
||||
)
|
||||
}
|
||||
statements.addAll(0, destructuringStatements)
|
||||
}.build()
|
||||
}
|
||||
|
||||
if (statements.isEmpty()) {
|
||||
statements.add(
|
||||
buildReturnExpression {
|
||||
source = expressionSource.fakeElement(KtFakeSourceElementKind.ImplicitReturn.FromExpressionBody)
|
||||
this.target = target
|
||||
result = buildUnitExpression {
|
||||
source = expressionSource.fakeElement(KtFakeSourceElementKind.ImplicitUnit.LambdaCoercion)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
statements.addAll(0, destructuringStatements)
|
||||
}.build()
|
||||
}
|
||||
}
|
||||
context.firFunctionTargets.removeLast()
|
||||
}.also {
|
||||
@@ -1820,8 +1830,9 @@ open class PsiRawFirBuilder(
|
||||
typeParameters += constructorTypeParametersFromConstructedClass(ownerTypeParameters)
|
||||
extractValueParametersTo(this, symbol, ValueParameterDeclaration.FUNCTION)
|
||||
|
||||
|
||||
val (body, contractDescription) = buildFirBody()
|
||||
val (body, contractDescription) = withForcedLocalContext {
|
||||
buildFirBody()
|
||||
}
|
||||
contractDescription?.let { this.contractDescription = it }
|
||||
this.body = body
|
||||
this@PsiRawFirBuilder.context.firFunctionTargets.removeLast()
|
||||
@@ -2027,7 +2038,11 @@ open class PsiRawFirBuilder(
|
||||
source = initializer.toFirSourceElement()
|
||||
moduleData = baseModuleData
|
||||
origin = FirDeclarationOrigin.Source
|
||||
body = buildOrLazyBlock { initializer.body.toFirBlock() }
|
||||
body = buildOrLazyBlock {
|
||||
withForcedLocalContext {
|
||||
initializer.body.toFirBlock()
|
||||
}
|
||||
}
|
||||
dispatchReceiverType = context.dispatchReceiverTypesStack.lastOrNull()
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -28,7 +28,7 @@ FILE: danglingAnnotationsClassLevel.kt
|
||||
|
||||
public? final? fun withLocal(): R|kotlin/Unit| {
|
||||
local final? class Local : R|kotlin/Any| {
|
||||
public? [ContainingClassKey=Local] constructor(): R|Outer.Local| {
|
||||
public? [ContainingClassKey=Local] constructor(): R|<local>/Local| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ FILE: enums3.kt
|
||||
}
|
||||
|
||||
init {
|
||||
local final? enum class Planet : R|kotlin/Enum<C.Planet>| {
|
||||
private [ContainingClassKey=Planet] constructor([CorrespondingProperty=<local>/m] m: Double, [CorrespondingProperty=<local>/r] r: Double): R|C.Planet| {
|
||||
super<R|kotlin/Enum<C.Planet>|>()
|
||||
local final? enum class Planet : R|kotlin/Enum<<local>/Planet>| {
|
||||
private [ContainingClassKey=Planet] constructor([CorrespondingProperty=<local>/m] m: Double, [CorrespondingProperty=<local>/r] r: Double): R|<local>/Planet| {
|
||||
super<R|kotlin/Enum<<local>/Planet>|>()
|
||||
}
|
||||
|
||||
public? final? [IsFromPrimaryConstructor=true] val m: Double = R|<local>/m|
|
||||
@@ -16,9 +16,9 @@ FILE: enums3.kt
|
||||
internal final? [IsFromPrimaryConstructor=true] val r: Double = R|<local>/r|
|
||||
internal [ContainingClassKey=Planet] get(): Double
|
||||
|
||||
public final static [ContainingClassKey=Planet] enum entry MERCURY: R|C.Planet| = object : R|C.Planet| {
|
||||
public final static [ContainingClassKey=Planet] enum entry MERCURY: R|<local>/Planet| = object : R|<local>/Planet| {
|
||||
private [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
|
||||
super<R|C.Planet|>(Double(1.0), Double(2.0))
|
||||
super<R|<local>/Planet|>(Double(1.0), Double(2.0))
|
||||
}
|
||||
|
||||
public? open? override fun sayHello(): R|kotlin/Unit| {
|
||||
@@ -27,9 +27,9 @@ FILE: enums3.kt
|
||||
|
||||
}
|
||||
|
||||
public final static [ContainingClassKey=Planet] enum entry VENERA: R|C.Planet| = object : R|C.Planet| {
|
||||
public final static [ContainingClassKey=Planet] enum entry VENERA: R|<local>/Planet| = object : R|<local>/Planet| {
|
||||
private [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
|
||||
super<R|C.Planet|>(Double(3.0), Double(4.0))
|
||||
super<R|<local>/Planet|>(Double(3.0), Double(4.0))
|
||||
}
|
||||
|
||||
public? open? override fun sayHello(): R|kotlin/Unit| {
|
||||
@@ -38,9 +38,9 @@ FILE: enums3.kt
|
||||
|
||||
}
|
||||
|
||||
public final static [ContainingClassKey=Planet] enum entry EARTH: R|C.Planet| = object : R|C.Planet| {
|
||||
public final static [ContainingClassKey=Planet] enum entry EARTH: R|<local>/Planet| = object : R|<local>/Planet| {
|
||||
private [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
|
||||
super<R|C.Planet|>(Double(5.0), Double(6.0))
|
||||
super<R|<local>/Planet|>(Double(5.0), Double(6.0))
|
||||
}
|
||||
|
||||
public? open? override fun sayHello(): R|kotlin/Unit| {
|
||||
@@ -55,7 +55,7 @@ FILE: enums3.kt
|
||||
public? abstract fun sayHello(): R|kotlin/Unit|
|
||||
|
||||
local final? companion [ContainingClassKey=Planet] object Companion : R|kotlin/Any| {
|
||||
private [ContainingClassKey=Companion] constructor(): R|C.Planet.Companion| {
|
||||
private [ContainingClassKey=Companion] constructor(): R|<local>/Planet.Companion| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -64,14 +64,14 @@ FILE: enums3.kt
|
||||
|
||||
}
|
||||
|
||||
public final static [ContainingClassKey=Planet] fun values(): R|kotlin/Array<C.Planet>| {
|
||||
public final static [ContainingClassKey=Planet] fun values(): R|kotlin/Array<<local>/Planet>| {
|
||||
}
|
||||
|
||||
public final static [ContainingClassKey=Planet] fun valueOf(value: R|kotlin/String|): R|C.Planet| {
|
||||
public final static [ContainingClassKey=Planet] fun valueOf(value: R|kotlin/String|): R|<local>/Planet| {
|
||||
}
|
||||
|
||||
public final static [ContainingClassKey=Planet] val entries: R|kotlin/enums/EnumEntries<C.Planet>|
|
||||
public get(): R|kotlin/enums/EnumEntries<C.Planet>|
|
||||
public final static [ContainingClassKey=Planet] val entries: R|kotlin/enums/EnumEntries<<local>/Planet>|
|
||||
public get(): R|kotlin/enums/EnumEntries<<local>/Planet>|
|
||||
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -6,7 +6,7 @@ FILE: initBlockWithDeclarations.kt
|
||||
|
||||
init {
|
||||
local final? class classInInit : R|kotlin/Any| {
|
||||
public? [ContainingClassKey=classInInit] constructor(): R|X.classInInit| {
|
||||
public? [ContainingClassKey=classInInit] constructor(): R|<local>/classInInit| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ FILE: initBlockWithDeclarations.kt
|
||||
|
||||
init {
|
||||
local final? class classInInit : R|kotlin/Any| {
|
||||
public? [ContainingClassKey=classInInit] constructor(): R|<no name provided>.classInInit| {
|
||||
public? [ContainingClassKey=classInInit] constructor(): R|<local>/classInInit| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ FILE: script.kts
|
||||
build#(<L> = build@fun <implicit>.<anonymous>(): <implicit> <inline=Unknown> {
|
||||
version# = String(123)
|
||||
local final? class A : R|kotlin/Any| {
|
||||
public? [ContainingClassKey=A] constructor(): R|A| {
|
||||
public? [ContainingClassKey=A] constructor(): R|<local>/A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
FILE: locals.kt
|
||||
public? final? fun withLocals(p: Int): Int {
|
||||
local final? class Local : R|kotlin/Any| {
|
||||
public? [ContainingClassKey=Local] constructor([CorrespondingProperty=<local>/pp] pp: Int): R|Local| {
|
||||
public? [ContainingClassKey=Local] constructor([CorrespondingProperty=<local>/pp] pp: Int): R|<local>/Local| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
+36
-4
@@ -75,10 +75,21 @@ abstract class AbstractRawFirBuilder<T>(val baseSession: FirSession, val context
|
||||
isExpect: Boolean,
|
||||
forceLocalContext: Boolean = false,
|
||||
l: () -> T
|
||||
) = when {
|
||||
forceLocalContext -> withForcedLocalContext {
|
||||
withChildClassNameRegardlessLocalContext(name, isExpect, l)
|
||||
}
|
||||
else -> {
|
||||
withChildClassNameRegardlessLocalContext(name, isExpect, l)
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <T> withChildClassNameRegardlessLocalContext(
|
||||
name: Name,
|
||||
isExpect: Boolean,
|
||||
l: () -> T
|
||||
): T {
|
||||
context.className = context.className.child(name)
|
||||
val oldForcedLocalContext = context.forcedLocalContext
|
||||
context.forcedLocalContext = forceLocalContext || context.forcedLocalContext
|
||||
val previousIsExpect = context.containerIsExpect
|
||||
context.containerIsExpect = previousIsExpect || isExpect
|
||||
val dispatchReceiversNumber = context.dispatchReceiverTypesStack.size
|
||||
@@ -94,11 +105,28 @@ abstract class AbstractRawFirBuilder<T>(val baseSession: FirSession, val context
|
||||
}
|
||||
|
||||
context.className = context.className.parent()
|
||||
context.forcedLocalContext = oldForcedLocalContext
|
||||
context.containerIsExpect = previousIsExpect
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <R> withForcedLocalContext(block: () -> R): R {
|
||||
val oldForcedLocalContext = context.inLocalContext
|
||||
context.inLocalContext = true
|
||||
val oldClassNameBeforeLocalContext = context.classNameBeforeLocalContext
|
||||
if (!oldForcedLocalContext) {
|
||||
context.classNameBeforeLocalContext = context.className
|
||||
}
|
||||
val oldClassName = context.className
|
||||
context.className = FqName.ROOT
|
||||
return try {
|
||||
block()
|
||||
} finally {
|
||||
context.classNameBeforeLocalContext = oldClassNameBeforeLocalContext
|
||||
context.inLocalContext = oldForcedLocalContext
|
||||
context.className = oldClassName
|
||||
}
|
||||
}
|
||||
|
||||
fun registerSelfType(selfType: FirResolvedTypeRef) {
|
||||
context.dispatchReceiverTypesStack.add(selfType.type as ConeClassLikeType)
|
||||
}
|
||||
@@ -132,7 +160,11 @@ abstract class AbstractRawFirBuilder<T>(val baseSession: FirSession, val context
|
||||
context.inLocalContext -> {
|
||||
val pathFqName =
|
||||
context.firFunctionTargets.fold(
|
||||
if (context.className.isRoot) context.packageFqName else context.currentClassId.asSingleFqName()
|
||||
if (context.classNameBeforeLocalContext.isRoot) {
|
||||
context.packageFqName
|
||||
} else {
|
||||
ClassId(context.packageFqName, context.classNameBeforeLocalContext, false).asSingleFqName()
|
||||
}
|
||||
) { result, firFunctionTarget ->
|
||||
if (firFunctionTarget.isLambda || firFunctionTarget.labelName == null)
|
||||
result
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.fir.declarations.builder.buildOuterClassTypeParamete
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
|
||||
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||
import org.jetbrains.kotlin.name.CallableId
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -22,9 +23,14 @@ import org.jetbrains.kotlin.name.Name
|
||||
class Context<T> {
|
||||
lateinit var packageFqName: FqName
|
||||
var className: FqName = FqName.ROOT
|
||||
var forcedLocalContext: Boolean = false
|
||||
val inLocalContext get() = forcedLocalContext || firFunctionTargets.isNotEmpty()
|
||||
val currentClassId get() = ClassId(packageFqName, className, inLocalContext)
|
||||
var inLocalContext: Boolean = false
|
||||
val currentClassId
|
||||
get() = when {
|
||||
inLocalContext -> ClassId(CallableId.PACKAGE_FQ_NAME_FOR_LOCAL, className, /*local =*/ true)
|
||||
else -> ClassId(packageFqName, className, /*local =*/ false)
|
||||
}
|
||||
|
||||
var classNameBeforeLocalContext: FqName = FqName.ROOT
|
||||
|
||||
val firFunctionTargets = mutableListOf<FirFunctionTarget>()
|
||||
val calleeNamesForLambda = mutableListOf<Name?>()
|
||||
|
||||
@@ -1,213 +0,0 @@
|
||||
fun test() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
|
||||
|
||||
class Test5(val x: Int) {
|
||||
constructor(): this(0)
|
||||
}
|
||||
fun Test5() {}
|
||||
fun Test5(x: Int) = x
|
||||
|
||||
fun local() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
|
||||
|
||||
class Test5(val x: Int) {
|
||||
constructor(): this(0)
|
||||
}
|
||||
fun Test5() {}
|
||||
fun Test5(x: Int) = x
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
init {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
|
||||
|
||||
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
||||
}
|
||||
<!CONFLICTING_OVERLOADS!>fun Test5()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun Test5(x: Int)<!> = x
|
||||
}
|
||||
|
||||
fun test() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
|
||||
|
||||
class Test5(val x: Int) {
|
||||
constructor(): this(0)
|
||||
}
|
||||
fun Test5() {}
|
||||
fun Test5(x: Int) = x
|
||||
}
|
||||
|
||||
val property: Any get() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
|
||||
|
||||
class Test5(val x: Int) {
|
||||
constructor(): this(0)
|
||||
}
|
||||
fun Test5() {}
|
||||
fun Test5(x: Int) = x
|
||||
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
val property: Any get() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
|
||||
|
||||
class Test5(val x: Int) {
|
||||
constructor(): this(0)
|
||||
}
|
||||
fun Test5() {}
|
||||
fun Test5(x: Int) = x
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
object Object {
|
||||
fun test() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
|
||||
|
||||
class Test5(val x: Int) {
|
||||
constructor(): this(0)
|
||||
}
|
||||
fun Test5() {}
|
||||
fun Test5(x: Int) = x
|
||||
}
|
||||
|
||||
val property: Any get() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
|
||||
|
||||
class Test5(val x: Int) {
|
||||
constructor(): this(0)
|
||||
}
|
||||
fun Test5() {}
|
||||
fun Test5(x: Int) = x
|
||||
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
val obj = object {
|
||||
fun test() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
|
||||
|
||||
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
||||
}
|
||||
<!CONFLICTING_OVERLOADS!>fun Test5()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun Test5(x: Int)<!> = x
|
||||
}
|
||||
|
||||
val property: Any get() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
|
||||
|
||||
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
||||
}
|
||||
<!CONFLICTING_OVERLOADS!>fun Test5()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun Test5(x: Int)<!> = x
|
||||
|
||||
return 0
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
fun test() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
|
||||
Reference in New Issue
Block a user