Raw FIR: make object/sealed/enum constructor visibility private
This commit is contained in:
@@ -384,11 +384,19 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
||||
superTypeCallEntry?.extractArgumentsTo(this)
|
||||
}
|
||||
}
|
||||
|
||||
fun defaultVisibility() =
|
||||
if (owner is KtObjectDeclaration || owner.hasModifier(SEALED_KEYWORD) || owner.hasModifier(ENUM_KEYWORD))
|
||||
// TODO: sealed is FILE_PRIVATE (?) object / enum is HIDDEN (?)
|
||||
Visibilities.PRIVATE
|
||||
else
|
||||
Visibilities.UNKNOWN
|
||||
|
||||
val firConstructor = FirPrimaryConstructorImpl(
|
||||
session,
|
||||
this ?: owner,
|
||||
FirFunctionSymbol(callableIdForClassConstructor()),
|
||||
this?.visibility ?: Visibilities.UNKNOWN,
|
||||
this?.visibility ?: defaultVisibility(),
|
||||
this?.hasExpectModifier() ?: false,
|
||||
this?.hasActualModifier() ?: false,
|
||||
delegatedSelfTypeRef,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FILE: enums.kt
|
||||
public? final? enum class Order : kotlin/Enum {
|
||||
public? constructor(): super<kotlin/Enum>()
|
||||
private constructor(): super<kotlin/Enum>()
|
||||
|
||||
public? final enum entry FIRST : kotlin/Any {
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
@@ -60,7 +60,7 @@ FILE: enums.kt
|
||||
public? abstract fun sayHello(): kotlin/Unit
|
||||
|
||||
public? final? companion object Companion : kotlin/Any {
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
private constructor(): super<kotlin/Any>()
|
||||
|
||||
public? final? const val G: <implicit> = Double(6.67E-11)
|
||||
public? get(): <implicit>
|
||||
|
||||
@@ -2,11 +2,11 @@ FILE: enums2.kt
|
||||
public? final? interface Some : kotlin/Any {
|
||||
}
|
||||
public? final? object O1 : Some {
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
private constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
public? final? object O2 : Some {
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
private constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
public? final? enum class SomeEnum : kotlin/Enum {
|
||||
|
||||
@@ -15,7 +15,7 @@ FILE: nestedClass.kt
|
||||
}
|
||||
|
||||
public? final? object Obj : Base {
|
||||
public? constructor(): super<Base>(String())
|
||||
private constructor(): super<Base>(String())
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ FILE: locals.kt
|
||||
}
|
||||
|
||||
lval code: <implicit> = object : Any {
|
||||
public? constructor(): super<Any>()
|
||||
private constructor(): super<Any>()
|
||||
|
||||
public? final? fun foo(): <implicit> {
|
||||
^foo hashCode#()
|
||||
|
||||
Reference in New Issue
Block a user