[FIR] Fix effective visibility handling for local members

In future 'Local' effective visibility could be used
as a flag of local declaration
This commit is contained in:
Mikhail Glukhikh
2020-06-01 15:11:18 +03:00
parent cb345a4c19
commit 0ffa0b2bd7
22 changed files with 47 additions and 44 deletions
@@ -47,7 +47,7 @@ FILE: localClassesWithImplicit.kt
}
lval x: R|anonymous| = object : R|kotlin/Any| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
+5 -5
View File
@@ -22,7 +22,7 @@ FILE: enum.kt
public get(): R|Some|
public final static enum entry FIRST: R|SomeEnum| = object : R|SomeEnum| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|SomeEnum|>(Q|O1|)
}
@@ -33,7 +33,7 @@ FILE: enum.kt
}
public final static enum entry SECOND: R|SomeEnum| = object : R|SomeEnum| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|SomeEnum|>(Q|O2|)
}
@@ -71,7 +71,7 @@ FILE: enum.kt
}
public final static enum entry E1: R|EnumClass| = object : R|EnumClass| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|EnumClass|>()
}
@@ -85,14 +85,14 @@ FILE: enum.kt
}
public final static enum entry E2: R|EnumClass| = object : R|EnumClass| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|EnumClass|>()
}
}
public final static enum entry E3: R|EnumClass| = object : R|EnumClass| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|EnumClass|>()
}
@@ -30,7 +30,7 @@ FILE: CallBasedInExpressionGenerator.kt
private final fun gen(argument: R|ERROR CLASS: Symbol not found, for `StackValue`|): R|ERROR CLASS: Symbol not found, for `BranchedValue`| {
^gen object : R|ERROR CLASS: Symbol not found, for `BranchedValue`| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|ERROR CLASS: Symbol not found, for `BranchedValue`|>(R|<local>/argument|, Null(null), R|<local>/argument|.<Unresolved name: type>#, <Unresolved name: Opcodes>#.<Unresolved name: IFEQ>#)
}
@@ -52,7 +52,7 @@ FILE: CallBasedInExpressionGenerator.kt
, R|<local>/jumpLabel|)
}
private final fun invokeFunction(v: R|ERROR CLASS: Symbol not found, for `InstructionAdapter`|): R|kotlin/Unit| {
private[local] final fun invokeFunction(v: R|ERROR CLASS: Symbol not found, for `InstructionAdapter`|): R|kotlin/Unit| {
lval result: <ERROR TYPE REF: Unresolved name: invokeFunction> = this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.codegen|.<Unresolved name: invokeFunction>#(this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.resolvedCall|.<Unresolved name: call>#, this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.resolvedCall|, <Unresolved name: none>#())
R|<local>/result|.<Unresolved name: put>#(R|<local>/result|.<Unresolved name: type>#, R|<local>/result|.<Unresolved name: kotlinType>#, R|<local>/v|)
}
@@ -7,7 +7,7 @@ FILE: enumEntryUse.kt
public final static enum entry FIRST: R|TestEnum|
public final static enum entry SECOND: R|TestEnum|
public final static enum entry THIRD: R|TestEnum| = object : R|TestEnum| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|TestEnum|>()
}
@@ -1,7 +1,7 @@
FILE: localImplicitBodies.kt
public final fun foo(): R|kotlin/Unit| {
lval x: R|anonymous| = object : R|kotlin/Any| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
@@ -3,7 +3,7 @@ FILE: localInnerClass.kt
}
public final fun bar(): R|kotlin/Unit| {
object : R|Foo| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
@@ -21,7 +21,7 @@ FILE: localObjects.kt
public final fun test(): R|kotlin/Unit| {
Q|A|.R|/A.x|
lval b: R|anonymous| = object : R|Foo| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|Foo|>()
}
@@ -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[local] constructor(): R|B| {
super<R|kotlin/Any|>()
}
@@ -23,7 +23,7 @@ FILE: localScopes.kt
R|<local>/base|.R|/BaseLocal.baz|()
R|<local>/base|.R|/Bar.foo|()
lval anonymous: R|anonymous| = object : R|Bar| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|Bar|>()
}
@@ -1,11 +1,11 @@
FILE: foo.kt
public final fun foo(): R|kotlin/Boolean| {
object : R|Node<kotlin/Boolean>| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
private final var result: R|kotlin/Boolean| = Boolean(false)
private[local] final var result: R|kotlin/Boolean| = Boolean(false)
private get(): R|kotlin/Boolean|
private set(value: R|kotlin/Boolean|): R|kotlin/Unit|
@@ -32,7 +32,7 @@ FILE: O.kt
public[private] final fun test(): R|kotlin/Unit| {
lval x: R|kotlin/Int| = this@R|/O.Derived|.R|/O.Derived.bar|
lval o: R|anonymous| = object : R|Wrapper| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|Wrapper|>(this@R|/O.Derived.Some|.R|/O.Derived.Some.z|)
}
@@ -41,7 +41,7 @@ FILE: O.kt
}
public[local] final val oo: R|anonymous| = object : R|kotlin/Any| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
@@ -61,7 +61,7 @@ FILE: O.kt
public[private] final fun test(): R|kotlin/Unit| {
lval x: R|kotlin/Int| = this@R|/O.Derived|.R|/O.Derived.bar|
lval o: R|anonymous| = object : R|kotlin/Any| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
@@ -86,11 +86,11 @@ FILE: O.kt
private final fun gen(): R|kotlin/Any| {
^gen object : R|Wrapper| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|Wrapper|>(Boolean(true))
}
private final fun invokeFunction(): R|kotlin/Unit| {
private[local] final fun invokeFunction(): R|kotlin/Unit| {
lval c: R|kotlin/Any| = this@R|/Generator|.R|/Generator.codegen|
lval cc: R|kotlin/Int| = this@R|/Generator|.R|/Generator.codegen|.R|kotlin/Any.hashCode|()
}
@@ -5,7 +5,7 @@ FILE: privateObjectLiteral.kt
}
private final val x: R|anonymous| = object : R|kotlin/Any| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
@@ -21,7 +21,7 @@ FILE: privateObjectLiteral.kt
public get(): R|kotlin/Int|
internal final val z: R|anonymous| = object : R|kotlin/Any| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
@@ -68,7 +68,7 @@ FILE: first.kt
super<R|kotlin/Any|>()
}
private final fun bar(): R|kotlin/Unit|
private[local] final fun bar(): R|kotlin/Unit|
public[local] final fun baz(): R|kotlin/Unit| {
this@R|/Local|.R|/Local.bar|()
@@ -26,7 +26,7 @@ FILE: enums.kt
internal get(): R|kotlin/Double|
public final static enum entry MERCURY: R|Planet| = object : R|Planet| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|Planet|>(Double(1.0), Double(2.0))
}
@@ -37,7 +37,7 @@ FILE: enums.kt
}
public final static enum entry VENERA: R|Planet| = object : R|Planet| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|Planet|>(Double(3.0), Double(4.0))
}
@@ -48,7 +48,7 @@ FILE: enums.kt
}
public final static enum entry EARTH: R|Planet| = object : R|Planet| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|Planet|>(Double(5.0), Double(6.0))
}
@@ -1,6 +1,6 @@
FILE: implicitInAnonymous.kt
private final val x: R|anonymous| = object : R|kotlin/Any| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
@@ -9,7 +9,7 @@ FILE: localObject.kt
public final fun tesLambda(x: R|kotlin/Int|): R|kotlin/Int| {
^tesLambda R|/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| {
lval obj: R|anonymous| = object : R|Foo| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
@@ -35,7 +35,7 @@ FILE: localObject.kt
public get(): R|kotlin/Int|
public set(value: R|kotlin/Int|): R|kotlin/Unit| {
lval obj: R|anonymous| = object : R|Foo| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
@@ -51,7 +51,7 @@ FILE: localObject.kt
public final val y: R|kotlin/Int|
public get(): R|kotlin/Int| {
lval obj: R|anonymous| = object : R|Foo| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
@@ -66,7 +66,7 @@ FILE: localObject.kt
public final val z: R|kotlin/Int| = this@R|/TestProperty|.R|kotlin/run|<R|TestProperty|, R|kotlin/Int|>(<L> = run@fun R|TestProperty|.<anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
lval obj: R|anonymous| = object : R|Foo| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
@@ -1,6 +1,6 @@
FILE: objectInnerClass.kt
public final val case1: R|anonymous| = object : R|A| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
@@ -68,7 +68,7 @@ FILE: objectInnerClass.kt
}
public final val x: R|anonymous| = object : R|Case2.Base| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
this@R|/Case2|.super<R|Case2.Base|>(R|/B.B|())
}
@@ -125,7 +125,7 @@ FILE: objectInnerClass.kt
}
public final val x: R|anonymous| = object : R|A| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
@@ -14,7 +14,7 @@ FILE: objectDerivedFromInnerClass.kt
}
public final fun test(): R|kotlin/Unit| {
lval x: R|anonymous| = object : R|Outer.Inner| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|Outer.Inner|>()
}
@@ -51,7 +51,7 @@ FILE: singletonConstructors.kt
}
public final static enum entry X: R|E| = object : R|E| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|E|>()
}
@@ -5,7 +5,7 @@ FILE: anonymousInDelegate.kt
}
public final val x: R|kotlin/Int|by R|kotlin/lazy|<R|kotlin/Int|>(<L> = lazy@fun <anonymous>(): R|kotlin/Int| {
lval foo: R|anonymous| = object : R|Foo| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
@@ -24,7 +24,7 @@ FILE: delegateWithAnonymousObject.kt
public final var issueListView: R|IssueListView|by this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(<L> = delegate@fun <anonymous>(): R|kotlin/properties/ReadWriteProperty<IssuesListUserProfile, IssueListView>| {
^ object : R|kotlin/properties/ReadWriteProperty<IssuesListUserProfile, IssueListView>| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
@@ -2,7 +2,7 @@ FILE: problems.kt
public final val sb: R|java/lang/StringBuilder| = R|java/lang/StringBuilder.StringBuilder|()
public get(): R|java/lang/StringBuilder|
public final val o: R|anonymous| = object : R|kotlin/Any| {
private constructor(): R|anonymous| {
private[local] constructor(): R|anonymous| {
super<R|kotlin/Any|>()
}
@@ -183,10 +183,13 @@ sealed class FirEffectiveVisibilityImpl(
override fun toVisibility() = Visibilities.PRIVATE
}
override fun lowerBound(other: FirEffectiveVisibility) = when (relation(other)) {
Permissiveness.SAME, Permissiveness.LESS -> this
Permissiveness.MORE -> other
Permissiveness.UNKNOWN -> Private
override fun lowerBound(other: FirEffectiveVisibility): FirEffectiveVisibility {
if (this == Local || other == Local) return Local
return when (relation(other)) {
Permissiveness.SAME, Permissiveness.LESS -> this
Permissiveness.MORE -> other
Permissiveness.UNKNOWN -> Private
}
}
companion object {