[FIR] Fix the TODO in FirConflictsHelpers
According to https://github.com/Kotlin/KEEP/blob/master/proposals/enhancing-main-convention.md#rules-and-semantics, only main function without args may avoid `CONFLICTING_OVERLOADS`, but since the jps/jps-plugin/testData/incremental/withJava/other/mainRedeclaration test dates back to 2015, this is not the current behavior.
This commit is contained in:
committed by
Space Team
parent
3014c7b353
commit
8541143d6f
+11
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.KtSourceElement
|
||||
import org.jetbrains.kotlin.descriptors.EffectiveVisibility
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.descriptors.Visibility
|
||||
import org.jetbrains.kotlin.fir.FirImplementationDetail
|
||||
import org.jetbrains.kotlin.fir.FirPureAbstractElement
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl.Modifier.*
|
||||
@@ -22,6 +23,9 @@ open class FirDeclarationStatusImpl(
|
||||
override val source: KtSourceElement? get() = null
|
||||
protected var flags: Int = HAS_STABLE_PARAMETER_NAMES.mask
|
||||
|
||||
@FirImplementationDetail
|
||||
internal val rawFlags get() = flags
|
||||
|
||||
operator fun get(modifier: Modifier): Boolean = (flags and modifier.mask) != 0
|
||||
|
||||
operator fun set(modifier: Modifier, value: Boolean) {
|
||||
@@ -182,3 +186,10 @@ open class FirDeclarationStatusImpl(
|
||||
return FirResolvedDeclarationStatusImpl(visibility, modality, effectiveVisibility, flags)
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(FirImplementationDetail::class)
|
||||
val FirDeclarationStatus.modifiersRepresentation: Any
|
||||
get() = when (this) {
|
||||
is FirDeclarationStatusImpl -> rawFlags
|
||||
else -> error("Generating modifier representations for ${this::class.simpleName} is not supported")
|
||||
}
|
||||
|
||||
+5
@@ -28,6 +28,11 @@ class FirResolvedDeclarationStatusImpl(
|
||||
Modality.FINAL,
|
||||
EffectiveVisibility.Public
|
||||
).apply { isSuspend = true }
|
||||
val DEFAULT_STATUS_FOR_SUSPEND_MAIN_FUNCTION = FirResolvedDeclarationStatusImpl(
|
||||
Visibilities.Public,
|
||||
Modality.FINAL,
|
||||
EffectiveVisibility.Public
|
||||
).apply { isSuspend = true }
|
||||
}
|
||||
|
||||
internal constructor(
|
||||
|
||||
Reference in New Issue
Block a user