[FIR] Make constructor delegate lazy in RawFirBuilder
Fifth step for ^KT-52615 Merge-request: KT-MR-7860 Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
This commit is contained in:
+16
-13
@@ -11,11 +11,13 @@ import kotlinx.collections.immutable.toPersistentList
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDeclarationDesignation
|
||||
import org.jetbrains.kotlin.fir.FirElement
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirPrimaryConstructor
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.getExplicitBackingField
|
||||
import org.jetbrains.kotlin.fir.expressions.FirFunctionCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirStatement
|
||||
import org.jetbrains.kotlin.fir.expressions.FirWrappedDelegateExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.impl.FirLazyBlock
|
||||
import org.jetbrains.kotlin.fir.expressions.impl.FirLazyDelegatedConstructorCall
|
||||
import org.jetbrains.kotlin.fir.expressions.impl.FirLazyExpression
|
||||
import org.jetbrains.kotlin.fir.psi
|
||||
import org.jetbrains.kotlin.fir.scopes.kotlinScopeProvider
|
||||
@@ -50,20 +52,21 @@ internal object FirLazyBodiesCalculator {
|
||||
}
|
||||
}
|
||||
|
||||
fun calculateLazyBodyForSecondaryConstructor(designation: FirDeclarationDesignation) {
|
||||
val secondaryConstructor = designation.declaration as FirConstructor
|
||||
require(!secondaryConstructor.isPrimary)
|
||||
if (secondaryConstructor.body !is FirLazyBlock) return
|
||||
fun calculateLazyBodyForConstructor(designation: FirDeclarationDesignation) {
|
||||
val constructor = designation.declaration as FirConstructor
|
||||
require(constructor.psi is KtConstructor<*>)
|
||||
require(constructor.body is FirLazyBlock || constructor.delegatedConstructor is FirLazyDelegatedConstructorCall)
|
||||
|
||||
val newFunction = RawFirNonLocalDeclarationBuilder.buildWithFunctionSymbolRebind(
|
||||
session = secondaryConstructor.moduleData.session,
|
||||
scopeProvider = secondaryConstructor.moduleData.session.kotlinScopeProvider,
|
||||
val newConstructor = RawFirNonLocalDeclarationBuilder.buildWithFunctionSymbolRebind(
|
||||
session = constructor.moduleData.session,
|
||||
scopeProvider = constructor.moduleData.session.kotlinScopeProvider,
|
||||
designation = designation,
|
||||
rootNonLocalDeclaration = secondaryConstructor.psi as KtSecondaryConstructor,
|
||||
) as FirSimpleFunction
|
||||
rootNonLocalDeclaration = constructor.psi as KtConstructor<*>,
|
||||
) as FirConstructor
|
||||
|
||||
secondaryConstructor.apply {
|
||||
replaceBody(newFunction.body)
|
||||
constructor.apply {
|
||||
replaceBody(newConstructor.body)
|
||||
replaceDelegatedConstructor(newConstructor.delegatedConstructor)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,9 +190,9 @@ private object FirLazyBodiesCalculatorTransformer : FirTransformer<PersistentLis
|
||||
constructor: FirConstructor,
|
||||
data: PersistentList<FirDeclaration>
|
||||
): FirConstructor {
|
||||
if (constructor.body is FirLazyBlock) {
|
||||
if (constructor.body is FirLazyBlock || constructor.delegatedConstructor is FirLazyDelegatedConstructorCall) {
|
||||
val designation = FirDeclarationDesignation(data, constructor)
|
||||
FirLazyBodiesCalculator.calculateLazyBodyForSecondaryConstructor(designation)
|
||||
FirLazyBodiesCalculator.calculateLazyBodyForConstructor(designation)
|
||||
}
|
||||
return constructor
|
||||
}
|
||||
|
||||
+72
-8
@@ -16,19 +16,20 @@ import org.jetbrains.kotlin.fir.builder.RawFirBuilder
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.isInner
|
||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
|
||||
import org.jetbrains.kotlin.fir.references.FirSuperReference
|
||||
import org.jetbrains.kotlin.fir.scopes.FirScopeProvider
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol
|
||||
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.psi
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.hasExpectModifier
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||
|
||||
internal class RawFirNonLocalDeclarationBuilder private constructor(
|
||||
session: FirSession,
|
||||
baseScopeProvider: FirScopeProvider,
|
||||
private val originalDeclarationIfParamertized: FirTypeParameterRefsOwner?,
|
||||
private val originalDeclaration: FirDeclaration,
|
||||
private val declarationToBuild: KtDeclaration,
|
||||
private val functionsToRebind: Set<FirFunction>? = null,
|
||||
private val replacementApplier: RawFirReplacement.Applier? = null
|
||||
@@ -45,7 +46,7 @@ internal class RawFirNonLocalDeclarationBuilder private constructor(
|
||||
val builder = RawFirNonLocalDeclarationBuilder(
|
||||
session = session,
|
||||
baseScopeProvider = scopeProvider,
|
||||
originalDeclarationIfParamertized = designation.declaration as? FirTypeParameterRefsOwner,
|
||||
originalDeclaration = designation.declaration,
|
||||
declarationToBuild = rootNonLocalDeclaration,
|
||||
replacementApplier = replacementApplier
|
||||
)
|
||||
@@ -62,7 +63,7 @@ internal class RawFirNonLocalDeclarationBuilder private constructor(
|
||||
rootNonLocalDeclaration: KtDeclaration,
|
||||
): FirDeclaration {
|
||||
val functionsToRebind = when (val originalDeclaration = designation.declaration) {
|
||||
is FirSimpleFunction -> setOf(originalDeclaration)
|
||||
is FirFunction -> setOf(originalDeclaration)
|
||||
is FirProperty -> setOfNotNull(originalDeclaration.getter, originalDeclaration.setter)
|
||||
else -> null
|
||||
}
|
||||
@@ -70,7 +71,7 @@ internal class RawFirNonLocalDeclarationBuilder private constructor(
|
||||
val builder = RawFirNonLocalDeclarationBuilder(
|
||||
session = session,
|
||||
baseScopeProvider = scopeProvider,
|
||||
originalDeclarationIfParamertized = designation.declaration as? FirTypeParameterRefsOwner,
|
||||
originalDeclaration = designation.declaration,
|
||||
declarationToBuild = rootNonLocalDeclaration,
|
||||
functionsToRebind = functionsToRebind,
|
||||
)
|
||||
@@ -89,8 +90,8 @@ internal class RawFirNonLocalDeclarationBuilder private constructor(
|
||||
declarationSource: KtSourceElement?,
|
||||
currentFirTypeParameters: List<FirTypeParameterRef>
|
||||
) {
|
||||
if (originalDeclarationIfParamertized != null && declarationSource?.psi == originalDeclarationIfParamertized.psi) {
|
||||
super.addCapturedTypeParameters(status, declarationSource, originalDeclarationIfParamertized.typeParameters)
|
||||
if (originalDeclaration is FirTypeParameterRefsOwner && declarationSource?.psi == originalDeclaration.psi) {
|
||||
super.addCapturedTypeParameters(status, declarationSource, originalDeclaration.typeParameters)
|
||||
} else {
|
||||
super.addCapturedTypeParameters(status, declarationSource, currentFirTypeParameters)
|
||||
}
|
||||
@@ -132,6 +133,55 @@ internal class RawFirNonLocalDeclarationBuilder private constructor(
|
||||
)
|
||||
}
|
||||
|
||||
private fun extractContructorConversionParams(
|
||||
classOrObject: KtClassOrObject,
|
||||
constructor: KtConstructor<*>
|
||||
): ConstructorConversionParams {
|
||||
val typeParameters = mutableListOf<FirTypeParameterRef>()
|
||||
context.appendOuterTypeParameters(ignoreLastLevel = false, typeParameters)
|
||||
val containingClass = this.containingClass ?: buildErrorWithAttachment("Constructor outside of class") {
|
||||
withPsiEntry("constructor", constructor)
|
||||
}
|
||||
val selfType = classOrObject.toDelegatedSelfType(typeParameters, containingClass.symbol)
|
||||
val superTypeCallEntry = classOrObject.superTypeListEntries.firstIsInstanceOrNull<KtSuperTypeCallEntry>()
|
||||
return ConstructorConversionParams(superTypeCallEntry, selfType, typeParameters)
|
||||
}
|
||||
|
||||
override fun visitSecondaryConstructor(constructor: KtSecondaryConstructor, data: Unit?): FirElement {
|
||||
val classOrObject = constructor.getContainingClassOrObject()
|
||||
val params = extractContructorConversionParams(classOrObject, constructor)
|
||||
val delegatedTypeRef = (originalDeclaration as FirConstructor).delegatedConstructor?.constructedTypeRef
|
||||
?: buildErrorWithAttachment("Secondary constructor without delegated call") {
|
||||
withPsiEntry("constructor", constructor)
|
||||
}
|
||||
return constructor.toFirConstructor(
|
||||
delegatedTypeRef,
|
||||
params.selfType,
|
||||
classOrObject,
|
||||
params.typeParameters,
|
||||
)
|
||||
}
|
||||
|
||||
override fun visitPrimaryConstructor(constructor: KtPrimaryConstructor, data: Unit?): FirElement {
|
||||
val classOrObject = constructor.getContainingClassOrObject()
|
||||
val params = extractContructorConversionParams(classOrObject, constructor)
|
||||
val firConstructor = originalDeclaration as FirConstructor
|
||||
val calleeReference = firConstructor.delegatedConstructor?.calleeReference as FirSuperReference?
|
||||
val newConstructor = constructor.toFirConstructor(
|
||||
params.superTypeCallEntry,
|
||||
firConstructor.delegatedConstructor?.constructedTypeRef,
|
||||
params.selfType,
|
||||
classOrObject,
|
||||
params.typeParameters,
|
||||
firConstructor.delegatedConstructor == null,
|
||||
copyConstructedTypeRefWithImplicitSource = false,
|
||||
)
|
||||
if (calleeReference != null) {
|
||||
(newConstructor.delegatedConstructor?.calleeReference as? FirSuperReference)?.replaceSuperTypeRef(calleeReference.superTypeRef)
|
||||
}
|
||||
return newConstructor
|
||||
}
|
||||
|
||||
override fun visitEnumEntry(enumEntry: KtEnumEntry, data: Unit?): FirElement {
|
||||
val owner = containingClass ?: buildErrorWithAttachment("Enum entry outside of class") {
|
||||
withPsiEntry("enumEntry", enumEntry)
|
||||
@@ -158,6 +208,14 @@ internal class RawFirNonLocalDeclarationBuilder private constructor(
|
||||
val ownerTypeArgumentsCount = containingClass?.typeParameters?.size
|
||||
visitor.convertProperty(declarationToBuild, ownerSymbol, ownerTypeArgumentsCount)
|
||||
}
|
||||
is KtConstructor<*> -> {
|
||||
if (containingClass == null) {
|
||||
// Constructor outside of class, syntax error, we should not do anything
|
||||
originalDeclaration
|
||||
} else {
|
||||
visitor.convertElement(declarationToBuild)
|
||||
}
|
||||
}
|
||||
else -> visitor.convertElement(declarationToBuild)
|
||||
} as FirDeclaration
|
||||
}
|
||||
@@ -182,5 +240,11 @@ internal class RawFirNonLocalDeclarationBuilder private constructor(
|
||||
|
||||
private fun PsiElement?.toDelegatedSelfType(firClass: FirRegularClass): FirResolvedTypeRef =
|
||||
toDelegatedSelfType(firClass.typeParameters, firClass.symbol)
|
||||
|
||||
private data class ConstructorConversionParams(
|
||||
val superTypeCallEntry: KtSuperTypeCallEntry?,
|
||||
val selfType: FirTypeRef,
|
||||
val typeParameters: List<FirTypeParameterRef>,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ FILE: annotationParameters.kt
|
||||
}
|
||||
public? final? [RAW_FIR] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Anno] constructor([RAW_FIR] [CorrespondingProperty=/Anno.args] args: A.X): R|Anno| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [RAW_FIR] [IsFromPrimaryConstructor=true] val args: A.X = R|<local>/args|
|
||||
@@ -57,7 +57,7 @@ FILE: annotationParameters.kt
|
||||
}
|
||||
public? final? [RAW_FIR] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Anno] constructor([RAW_FIR] [CorrespondingProperty=/Anno.args] args: A.X): R|Anno| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [RAW_FIR] [IsFromPrimaryConstructor=true] val args: A.X = R|<local>/args|
|
||||
@@ -95,7 +95,7 @@ FILE: annotationParameters.kt
|
||||
}
|
||||
public? final? [RAW_FIR] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Anno] constructor([RAW_FIR] [CorrespondingProperty=/Anno.args] args: A.X): R|Anno| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [RAW_FIR] [IsFromPrimaryConstructor=true] val args: A.X = R|<local>/args|
|
||||
@@ -133,7 +133,7 @@ FILE: annotationParameters.kt
|
||||
}
|
||||
public? final? [RAW_FIR] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Anno] constructor([RAW_FIR] [CorrespondingProperty=/Anno.args] args: A.X): R|Anno| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [RAW_FIR] [IsFromPrimaryConstructor=true] val args: A.X = R|<local>/args|
|
||||
@@ -171,7 +171,7 @@ FILE: annotationParameters.kt
|
||||
}
|
||||
public? final? [RAW_FIR] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Anno] constructor([RAW_FIR] [CorrespondingProperty=/Anno.args] args: A.X): R|Anno| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [RAW_FIR] [IsFromPrimaryConstructor=true] val args: A.X = R|<local>/args|
|
||||
@@ -209,7 +209,7 @@ FILE: annotationParameters.kt
|
||||
}
|
||||
public? final? [COMPILER_REQUIRED_ANNOTATIONS] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [COMPILER_REQUIRED_ANNOTATIONS] [ContainingClassKey=Anno] constructor([COMPILER_REQUIRED_ANNOTATIONS] [CorrespondingProperty=/Anno.args] args: A.X): R|Anno| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [COMPILER_REQUIRED_ANNOTATIONS] [IsFromPrimaryConstructor=true] val args: A.X = R|<local>/args|
|
||||
@@ -247,7 +247,7 @@ FILE: annotationParameters.kt
|
||||
}
|
||||
public? final? [COMPILER_REQUIRED_ANNOTATIONS] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [COMPILER_REQUIRED_ANNOTATIONS] [ContainingClassKey=Anno] constructor([COMPILER_REQUIRED_ANNOTATIONS] [CorrespondingProperty=/Anno.args] args: A.X): R|Anno| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [COMPILER_REQUIRED_ANNOTATIONS] [IsFromPrimaryConstructor=true] val args: A.X = R|<local>/args|
|
||||
@@ -285,7 +285,7 @@ FILE: annotationParameters.kt
|
||||
}
|
||||
public? final? [COMPILER_REQUIRED_ANNOTATIONS] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [COMPILER_REQUIRED_ANNOTATIONS] [ContainingClassKey=Anno] constructor([COMPILER_REQUIRED_ANNOTATIONS] [CorrespondingProperty=/Anno.args] args: A.X): R|Anno| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [COMPILER_REQUIRED_ANNOTATIONS] [IsFromPrimaryConstructor=true] val args: A.X = R|<local>/args|
|
||||
@@ -323,7 +323,7 @@ FILE: annotationParameters.kt
|
||||
}
|
||||
public? final? [COMPILER_REQUIRED_ANNOTATIONS] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [COMPILER_REQUIRED_ANNOTATIONS] [ContainingClassKey=Anno] constructor([COMPILER_REQUIRED_ANNOTATIONS] [CorrespondingProperty=/Anno.args] args: A.X): R|Anno| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [COMPILER_REQUIRED_ANNOTATIONS] [IsFromPrimaryConstructor=true] val args: A.X = R|<local>/args|
|
||||
@@ -362,7 +362,7 @@ FILE: annotationParameters.kt
|
||||
}
|
||||
public? final? [COMPILER_REQUIRED_ANNOTATIONS] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [COMPILER_REQUIRED_ANNOTATIONS] [ContainingClassKey=Anno] constructor([COMPILER_REQUIRED_ANNOTATIONS] [CorrespondingProperty=/Anno.args] args: A.X): R|Anno| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [COMPILER_REQUIRED_ANNOTATIONS] [IsFromPrimaryConstructor=true] val args: A.X = R|<local>/args|
|
||||
@@ -401,7 +401,7 @@ FILE: annotationParameters.kt
|
||||
}
|
||||
public final [SUPER_TYPES] annotation class Anno : R|kotlin/Annotation| {
|
||||
public [STATUS] [ContainingClassKey=Anno] constructor([STATUS] [CorrespondingProperty=/Anno.args] args: <ERROR TYPE REF: Symbol not found for A.X>): R|Anno| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [SUPER_TYPES] [IsFromPrimaryConstructor=true] val args: A.X = R|<local>/args|
|
||||
@@ -440,7 +440,7 @@ FILE: annotationParameters.kt
|
||||
}
|
||||
public final [SUPER_TYPES] annotation class Anno : R|kotlin/Annotation| {
|
||||
public [STATUS] [ContainingClassKey=Anno] constructor([STATUS] [CorrespondingProperty=/Anno.args] args: <ERROR TYPE REF: Symbol not found for A.X>): R|Anno| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [SUPER_TYPES] [IsFromPrimaryConstructor=true] val args: A.X = R|<local>/args|
|
||||
@@ -479,7 +479,7 @@ FILE: annotationParameters.kt
|
||||
}
|
||||
public final [SUPER_TYPES] annotation class Anno : R|kotlin/Annotation| {
|
||||
public [STATUS] [ContainingClassKey=Anno] constructor([STATUS] [CorrespondingProperty=/Anno.args] args: <ERROR TYPE REF: Symbol not found for A.X>): R|Anno| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [SUPER_TYPES] [IsFromPrimaryConstructor=true] val args: A.X = R|<local>/args|
|
||||
|
||||
+8
-8
@@ -3,7 +3,7 @@ RAW_FIR:
|
||||
FILE: classWithTypeParameters.kt
|
||||
public? final? [RAW_FIR] class ResolveMe<[RAW_FIR] T : Int, [RAW_FIR] K> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=ResolveMe] constructor<[RAW_FIR] T : Int, [RAW_FIR] K>(): R|ResolveMe<T, K>| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ IMPORTS:
|
||||
FILE: classWithTypeParameters.kt
|
||||
public? final? [RAW_FIR] class ResolveMe<[RAW_FIR] T : Int, [RAW_FIR] K> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=ResolveMe] constructor<[RAW_FIR] T : Int, [RAW_FIR] K>(): R|ResolveMe<T, K>| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,7 +21,7 @@ COMPILER_REQUIRED_ANNOTATIONS:
|
||||
FILE: classWithTypeParameters.kt
|
||||
public? final? [COMPILER_REQUIRED_ANNOTATIONS] class ResolveMe<[COMPILER_REQUIRED_ANNOTATIONS] T : Int, [COMPILER_REQUIRED_ANNOTATIONS] K> : R|kotlin/Any| {
|
||||
public? [COMPILER_REQUIRED_ANNOTATIONS] [ContainingClassKey=ResolveMe] constructor<[COMPILER_REQUIRED_ANNOTATIONS] T : Int, [COMPILER_REQUIRED_ANNOTATIONS] K>(): R|ResolveMe<T, K>| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,7 +30,7 @@ COMPANION_GENERATION:
|
||||
FILE: classWithTypeParameters.kt
|
||||
public? final? [COMPANION_GENERATION] class ResolveMe<[COMPANION_GENERATION] T : Int, [COMPANION_GENERATION] K> : R|kotlin/Any| {
|
||||
public? [COMPANION_GENERATION] [ContainingClassKey=ResolveMe] constructor<[COMPANION_GENERATION] T : Int, [COMPANION_GENERATION] K>(): R|ResolveMe<T, K>| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,7 +39,7 @@ SUPER_TYPES:
|
||||
FILE: classWithTypeParameters.kt
|
||||
public? final? [SUPER_TYPES] class ResolveMe<[SUPER_TYPES] T : Int, [SUPER_TYPES] K> : R|kotlin/Any| {
|
||||
public? [SUPER_TYPES] [ContainingClassKey=ResolveMe] constructor<[SUPER_TYPES] T : Int, [SUPER_TYPES] K>(): R|ResolveMe<T, K>| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,7 +48,7 @@ TYPES:
|
||||
FILE: classWithTypeParameters.kt
|
||||
public? final? [TYPES] class ResolveMe<[TYPES] T : R|kotlin/Int|, [TYPES] K> : R|kotlin/Any| {
|
||||
public? [TYPES] [ContainingClassKey=ResolveMe] constructor<[TYPES] T : R|kotlin/Int|, [TYPES] K>(): R|ResolveMe<T, K>| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
}
|
||||
@@ -57,7 +57,7 @@ STATUS:
|
||||
FILE: classWithTypeParameters.kt
|
||||
public final [STATUS] class ResolveMe<[STATUS] T : R|kotlin/Int|, [STATUS] K> : R|kotlin/Any| {
|
||||
public [STATUS] [ContainingClassKey=ResolveMe] constructor<[STATUS] T : R|kotlin/Int|, [STATUS] K>(): R|ResolveMe<T, K>| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
}
|
||||
@@ -66,7 +66,7 @@ ARGUMENTS_OF_ANNOTATIONS:
|
||||
FILE: classWithTypeParameters.kt
|
||||
public final [ARGUMENTS_OF_ANNOTATIONS] class ResolveMe<[ARGUMENTS_OF_ANNOTATIONS] T : R|kotlin/Int|, [ARGUMENTS_OF_ANNOTATIONS] K> : R|kotlin/Any| {
|
||||
public [ARGUMENTS_OF_ANNOTATIONS] [ContainingClassKey=ResolveMe] constructor<[ARGUMENTS_OF_ANNOTATIONS] T : R|kotlin/Int|, [ARGUMENTS_OF_ANNOTATIONS] K>(): R|ResolveMe<T, K>| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+13
-13
@@ -3,7 +3,7 @@ RAW_FIR:
|
||||
FILE: functionInValueClass.kt
|
||||
@JvmInline() public? final? inline [RAW_FIR] class Value : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Value] constructor([RAW_FIR] [CorrespondingProperty=/Value.value] value: Int): R|Value| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [RAW_FIR] [IsFromPrimaryConstructor=true] val value: Int = R|<local>/value|
|
||||
@@ -17,7 +17,7 @@ IMPORTS:
|
||||
FILE: functionInValueClass.kt
|
||||
@JvmInline() public? final? inline [RAW_FIR] class Value : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Value] constructor([RAW_FIR] [CorrespondingProperty=/Value.value] value: Int): R|Value| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [RAW_FIR] [IsFromPrimaryConstructor=true] val value: Int = R|<local>/value|
|
||||
@@ -31,7 +31,7 @@ COMPILER_REQUIRED_ANNOTATIONS:
|
||||
FILE: functionInValueClass.kt
|
||||
@JvmInline() public? final? inline [RAW_FIR] class Value : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Value] constructor([RAW_FIR] [CorrespondingProperty=/Value.value] value: Int): R|Value| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [RAW_FIR] [IsFromPrimaryConstructor=true] val value: Int = R|<local>/value|
|
||||
@@ -45,7 +45,7 @@ COMPANION_GENERATION:
|
||||
FILE: functionInValueClass.kt
|
||||
@JvmInline() public? final? inline [RAW_FIR] class Value : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Value] constructor([RAW_FIR] [CorrespondingProperty=/Value.value] value: Int): R|Value| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [RAW_FIR] [IsFromPrimaryConstructor=true] val value: Int = R|<local>/value|
|
||||
@@ -59,7 +59,7 @@ SUPER_TYPES:
|
||||
FILE: functionInValueClass.kt
|
||||
@JvmInline() public? final? inline [RAW_FIR] class Value : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Value] constructor([RAW_FIR] [CorrespondingProperty=/Value.value] value: Int): R|Value| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [RAW_FIR] [IsFromPrimaryConstructor=true] val value: Int = R|<local>/value|
|
||||
@@ -73,7 +73,7 @@ TYPES:
|
||||
FILE: functionInValueClass.kt
|
||||
@R|kotlin/jvm/JvmInline|() public? final? inline [SUPER_TYPES] class Value : R|kotlin/Any| {
|
||||
public? [SUPER_TYPES] [ContainingClassKey=Value] constructor([SUPER_TYPES] [CorrespondingProperty=/Value.value] value: Int): R|Value| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [SUPER_TYPES] [IsFromPrimaryConstructor=true] val value: Int = R|<local>/value|
|
||||
@@ -87,7 +87,7 @@ STATUS:
|
||||
FILE: functionInValueClass.kt
|
||||
@R|kotlin/jvm/JvmInline|() public final inline [SUPER_TYPES] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=kotlin/Int)] class Value : R|kotlin/Any| {
|
||||
public? [TYPES] [ContainingClassKey=Value] constructor([TYPES] [CorrespondingProperty=/Value.value] value: R|kotlin/Int|): R|Value| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [SUPER_TYPES] [IsFromPrimaryConstructor=true] val value: Int = R|<local>/value|
|
||||
@@ -101,7 +101,7 @@ ARGUMENTS_OF_ANNOTATIONS:
|
||||
FILE: functionInValueClass.kt
|
||||
@R|kotlin/jvm/JvmInline|() public final inline [SUPER_TYPES] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=kotlin/Int)] class Value : R|kotlin/Any| {
|
||||
public? [TYPES] [ContainingClassKey=Value] constructor([TYPES] [CorrespondingProperty=/Value.value] value: R|kotlin/Int|): R|Value| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [SUPER_TYPES] [IsFromPrimaryConstructor=true] val value: Int = R|<local>/value|
|
||||
@@ -115,7 +115,7 @@ CONTRACTS:
|
||||
FILE: functionInValueClass.kt
|
||||
@R|kotlin/jvm/JvmInline|() public final inline [SUPER_TYPES] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=kotlin/Int)] class Value : R|kotlin/Any| {
|
||||
public? [TYPES] [ContainingClassKey=Value] constructor([TYPES] [CorrespondingProperty=/Value.value] value: R|kotlin/Int|): R|Value| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? [SUPER_TYPES] [IsFromPrimaryConstructor=true] val value: Int = R|<local>/value|
|
||||
@@ -130,7 +130,7 @@ IMPLICIT_TYPES_BODY_RESOLVE:
|
||||
FILE: functionInValueClass.kt
|
||||
@R|kotlin/jvm/JvmInline|() public final inline [STATUS] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=kotlin/Int)] class Value : R|kotlin/Any| {
|
||||
public [STATUS] [ContainingClassKey=Value] constructor([STATUS] [CorrespondingProperty=/Value.value] value: R|kotlin/Int|): R|Value| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public final [STATUS] [IsFromPrimaryConstructor=true] val value: R|kotlin/Int| = R|<local>/value|
|
||||
@@ -145,7 +145,7 @@ ANNOTATIONS_ARGUMENTS_MAPPING:
|
||||
FILE: functionInValueClass.kt
|
||||
@R|kotlin/jvm/JvmInline|() public final inline [STATUS] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=kotlin/Int)] class Value : R|kotlin/Any| {
|
||||
public [STATUS] [ContainingClassKey=Value] constructor([STATUS] [CorrespondingProperty=/Value.value] value: R|kotlin/Int|): R|Value| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public final [STATUS] [IsFromPrimaryConstructor=true] val value: R|kotlin/Int| = R|<local>/value|
|
||||
@@ -160,7 +160,7 @@ EXPECT_ACTUAL_MATCHING:
|
||||
FILE: functionInValueClass.kt
|
||||
@R|kotlin/jvm/JvmInline|() public final inline [STATUS] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=kotlin/Int)] class Value : R|kotlin/Any| {
|
||||
public [STATUS] [ContainingClassKey=Value] constructor([STATUS] [CorrespondingProperty=/Value.value] value: R|kotlin/Int|): R|Value| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public final [STATUS] [IsFromPrimaryConstructor=true] val value: R|kotlin/Int| = R|<local>/value|
|
||||
@@ -175,7 +175,7 @@ BODY_RESOLVE:
|
||||
FILE: functionInValueClass.kt
|
||||
@R|kotlin/jvm/JvmInline|() public final inline [STATUS] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=kotlin/Int)] class Value : R|kotlin/Any| {
|
||||
public [STATUS] [ContainingClassKey=Value] constructor([STATUS] [CorrespondingProperty=/Value.value] value: R|kotlin/Int|): R|Value| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public final [STATUS] [IsFromPrimaryConstructor=true] val value: R|kotlin/Int| = R|<local>/value|
|
||||
|
||||
@@ -4,10 +4,7 @@ FILE: secondaryConstructor.kt
|
||||
public? final? [RAW_FIR] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] fun receive([RAW_FIR] value: A): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] class A : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
[RAW_FIR] lval a: <implicit> = x#
|
||||
}
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -16,10 +13,7 @@ FILE: secondaryConstructor.kt
|
||||
public? final? [RAW_FIR] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] fun receive([RAW_FIR] value: A): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] class A : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
[RAW_FIR] lval a: <implicit> = x#
|
||||
}
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -28,10 +22,7 @@ FILE: secondaryConstructor.kt
|
||||
public? final? [COMPILER_REQUIRED_ANNOTATIONS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] fun receive([RAW_FIR] value: A): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] class A : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
[RAW_FIR] lval a: <implicit> = x#
|
||||
}
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -40,10 +31,7 @@ FILE: secondaryConstructor.kt
|
||||
public? final? [COMPANION_GENERATION] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] fun receive([RAW_FIR] value: A): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] class A : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
[RAW_FIR] lval a: <implicit> = x#
|
||||
}
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -52,10 +40,7 @@ FILE: secondaryConstructor.kt
|
||||
public? final? [SUPER_TYPES] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] fun receive([RAW_FIR] value: A): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] class A : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
[RAW_FIR] lval a: <implicit> = x#
|
||||
}
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -64,10 +49,7 @@ FILE: secondaryConstructor.kt
|
||||
public? final? [TYPES] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] fun receive([RAW_FIR] value: A): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] class A : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
[RAW_FIR] lval a: <implicit> = x#
|
||||
}
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -76,10 +58,7 @@ FILE: secondaryConstructor.kt
|
||||
public final [STATUS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] fun receive([RAW_FIR] value: A): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] class A : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
[RAW_FIR] lval a: <implicit> = x#
|
||||
}
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -88,10 +67,7 @@ FILE: secondaryConstructor.kt
|
||||
public final [ARGUMENTS_OF_ANNOTATIONS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] fun receive([RAW_FIR] value: A): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] class A : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
[RAW_FIR] lval a: <implicit> = x#
|
||||
}
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -102,10 +78,7 @@ FILE: secondaryConstructor.kt
|
||||
}
|
||||
public? final? [RAW_FIR] fun receive([RAW_FIR] value: A): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] class A : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
[RAW_FIR] lval a: <implicit> = x#
|
||||
}
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -116,10 +89,7 @@ FILE: secondaryConstructor.kt
|
||||
}
|
||||
public? final? [RAW_FIR] fun receive([RAW_FIR] value: A): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] class A : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
[RAW_FIR] lval a: <implicit> = x#
|
||||
}
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -130,10 +100,7 @@ FILE: secondaryConstructor.kt
|
||||
}
|
||||
public? final? [RAW_FIR] fun receive([RAW_FIR] value: A): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] class A : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
[RAW_FIR] lval a: <implicit> = x#
|
||||
}
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -144,10 +111,7 @@ FILE: secondaryConstructor.kt
|
||||
}
|
||||
public? final? [RAW_FIR] fun receive([RAW_FIR] value: A): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] class A : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
[RAW_FIR] lval a: <implicit> = x#
|
||||
}
|
||||
public? [RAW_FIR] [ContainingClassKey=A] constructor([RAW_FIR] x: Int): R|A| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
@@ -159,10 +123,7 @@ FILE: secondaryConstructor.kt
|
||||
public final [CONTRACTS] fun receive([CONTRACTS] value: R|A|): R|kotlin/Unit| {
|
||||
}
|
||||
public final [STATUS] class A : R|kotlin/Any| {
|
||||
public [STATUS] [ContainingClassKey=A] constructor([STATUS] x: R|kotlin/Int|): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
[RAW_FIR] lval a: <implicit> = x#
|
||||
}
|
||||
public [STATUS] [ContainingClassKey=A] constructor([STATUS] x: R|kotlin/Int|): R|A| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -133,6 +133,10 @@ class FirJavaConstructor @FirImplementationDetail constructor(
|
||||
valueParameters += newValueParameters
|
||||
}
|
||||
|
||||
override fun replaceDelegatedConstructor(newDelegatedConstructor: FirDelegatedConstructorCall?) {
|
||||
error("Delegated constructor cannot be replaced for FirJavaConstructor")
|
||||
}
|
||||
|
||||
override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?) {}
|
||||
|
||||
override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider) {
|
||||
|
||||
+81
-38
@@ -188,6 +188,29 @@ open class RawFirBuilder(
|
||||
return buildOrLazy(buildBlock, ::buildLazyBlock)
|
||||
}
|
||||
|
||||
private inline fun buildOrLazyDelegatedConstructorCall(
|
||||
isThis: Boolean,
|
||||
constructedTypeRef: FirTypeRef,
|
||||
buildCall: () -> FirDelegatedConstructorCall
|
||||
): FirDelegatedConstructorCall {
|
||||
return buildOrLazy(buildCall, {
|
||||
buildLazyDelegatedConstructorCall {
|
||||
this.isThis = isThis
|
||||
this.constructedTypeRef = constructedTypeRef
|
||||
calleeReference = if (isThis) {
|
||||
buildExplicitThisReference {
|
||||
source = null
|
||||
}
|
||||
} else {
|
||||
buildExplicitSuperReference {
|
||||
source = null
|
||||
superTypeRef = constructedTypeRef
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
open fun convertElement(element: KtElement): FirElement? =
|
||||
element.accept(this@Visitor, Unit)
|
||||
|
||||
@@ -206,7 +229,8 @@ open class RawFirBuilder(
|
||||
defaultTypeRef: FirTypeRef? = null,
|
||||
valueParameterDeclaration: ValueParameterDeclaration,
|
||||
additionalAnnotations: List<FirAnnotation> = emptyList()
|
||||
): FirValueParameter = valueParameter.toFirValueParameter(defaultTypeRef, functionSymbol, valueParameterDeclaration, additionalAnnotations)
|
||||
): FirValueParameter =
|
||||
valueParameter.toFirValueParameter(defaultTypeRef, functionSymbol, valueParameterDeclaration, additionalAnnotations)
|
||||
|
||||
private fun KtTypeReference?.toFirOrImplicitType(): FirTypeRef =
|
||||
convertSafe() ?: buildImplicitTypeRef {
|
||||
@@ -291,14 +315,12 @@ open class RawFirBuilder(
|
||||
): FirDeclaration {
|
||||
return when (this) {
|
||||
is KtSecondaryConstructor -> {
|
||||
disabledLazyMode {
|
||||
toFirConstructor(
|
||||
delegatedSuperType,
|
||||
delegatedSelfType,
|
||||
owner,
|
||||
ownerTypeParameters
|
||||
)
|
||||
}
|
||||
toFirConstructor(
|
||||
if (isDelegatedCallToThis()) delegatedSelfType else delegatedSuperType,
|
||||
delegatedSelfType,
|
||||
owner,
|
||||
ownerTypeParameters,
|
||||
)
|
||||
}
|
||||
is KtEnumEntry -> {
|
||||
val primaryConstructor = owner.primaryConstructor
|
||||
@@ -890,11 +912,12 @@ open class RawFirBuilder(
|
||||
if (primaryConstructor != null || (this !is KtClass || !this.isInterface()) && shouldGenerateImplicitPrimaryConstructor) {
|
||||
val firPrimaryConstructor = primaryConstructor.toFirConstructor(
|
||||
superTypeCallEntry,
|
||||
delegatedSuperTypeRef!!,
|
||||
delegatedSuperTypeRef,
|
||||
delegatedSelfTypeRef ?: delegatedSuperTypeRef!!,
|
||||
owner = this,
|
||||
containerTypeParameters,
|
||||
containingClassIsExpectClass,
|
||||
copyConstructedTypeRefWithImplicitSource = true,
|
||||
)
|
||||
container.declarations += firPrimaryConstructor
|
||||
}
|
||||
@@ -902,27 +925,49 @@ open class RawFirBuilder(
|
||||
return delegatedSuperTypeRef!! to delegateFieldsMap.takeIf { it.isNotEmpty() }
|
||||
}
|
||||
|
||||
private fun KtPrimaryConstructor?.toFirConstructor(
|
||||
/**
|
||||
* @param delegatedSuperTypeRef can be null if containingClassIsExpectClass is true
|
||||
*/
|
||||
protected fun KtPrimaryConstructor?.toFirConstructor(
|
||||
superTypeCallEntry: KtSuperTypeCallEntry?,
|
||||
delegatedSuperTypeRef: FirTypeRef,
|
||||
delegatedSuperTypeRef: FirTypeRef?,
|
||||
delegatedSelfTypeRef: FirTypeRef,
|
||||
owner: KtClassOrObject,
|
||||
ownerTypeParameters: List<FirTypeParameterRef>,
|
||||
containingClassIsExpectClass: Boolean,
|
||||
copyConstructedTypeRefWithImplicitSource: Boolean,
|
||||
): FirConstructor {
|
||||
val constructorCall = superTypeCallEntry?.toFirSourceElement()
|
||||
val constructorSource = this?.toFirSourceElement()
|
||||
?: owner.toKtPsiSourceElement(KtFakeSourceElementKind.ImplicitConstructor)
|
||||
val firDelegatedCall = if (containingClassIsExpectClass) null else buildDelegatedConstructorCall {
|
||||
source = constructorCall ?: constructorSource.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall)
|
||||
constructedTypeRef = delegatedSuperTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.ImplicitTypeRef)
|
||||
isThis = false
|
||||
calleeReference = buildExplicitSuperReference {
|
||||
source = superTypeCallEntry?.calleeExpression?.toFirSourceElement(KtFakeSourceElementKind.DelegatingConstructorCall)
|
||||
?: this@buildDelegatedConstructorCall.source?.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall)
|
||||
superTypeRef = this@buildDelegatedConstructorCall.constructedTypeRef
|
||||
val firDelegatedCall = if (containingClassIsExpectClass) null else {
|
||||
val constructedTypeRef = if (copyConstructedTypeRefWithImplicitSource) {
|
||||
delegatedSuperTypeRef!!.copyWithNewSourceKind(KtFakeSourceElementKind.ImplicitTypeRef)
|
||||
} else {
|
||||
delegatedSuperTypeRef!!
|
||||
}
|
||||
superTypeCallEntry?.extractArgumentsTo(this)
|
||||
val delegatedConstructorCall = {
|
||||
buildDelegatedConstructorCall {
|
||||
source = constructorCall ?: constructorSource.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall)
|
||||
this.constructedTypeRef = constructedTypeRef
|
||||
isThis = false
|
||||
calleeReference = buildExplicitSuperReference {
|
||||
source =
|
||||
superTypeCallEntry?.calleeExpression?.toFirSourceElement(KtFakeSourceElementKind.DelegatingConstructorCall)
|
||||
?: this@buildDelegatedConstructorCall.source?.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall)
|
||||
superTypeRef = this@buildDelegatedConstructorCall.constructedTypeRef
|
||||
}
|
||||
superTypeCallEntry?.extractArgumentsTo(this)
|
||||
}
|
||||
}
|
||||
if (this == null && owner !is KtEnumEntry) {
|
||||
// primary constructor without body
|
||||
delegatedConstructorCall()
|
||||
} else buildOrLazyDelegatedConstructorCall(
|
||||
isThis = false,
|
||||
constructedTypeRef,
|
||||
delegatedConstructorCall,
|
||||
)
|
||||
}
|
||||
|
||||
// See DescriptorUtils#getDefaultConstructorVisibility in core.descriptors
|
||||
@@ -1003,7 +1048,7 @@ open class RawFirBuilder(
|
||||
}
|
||||
}
|
||||
|
||||
private fun convertScript(script: KtScript, containingFile: FirFileBuilder,): FirScript {
|
||||
private fun convertScript(script: KtScript, containingFile: FirFileBuilder): FirScript {
|
||||
return buildScript {
|
||||
source = script.toFirSourceElement()
|
||||
moduleData = baseModuleData
|
||||
@@ -1086,7 +1131,8 @@ open class RawFirBuilder(
|
||||
delegatedEntrySelfType,
|
||||
owner = ktEnumEntry,
|
||||
typeParameters,
|
||||
containingClassIsExpectClass
|
||||
containingClassIsExpectClass,
|
||||
copyConstructedTypeRefWithImplicitSource = true,
|
||||
)
|
||||
// Use ANONYMOUS_OBJECT_NAME for the owner class id for enum entry declarations (see KT-42351)
|
||||
withChildClassName(SpecialNames.ANONYMOUS, forceLocalContext = true, isExpect = false) {
|
||||
@@ -1541,9 +1587,9 @@ open class RawFirBuilder(
|
||||
}
|
||||
}
|
||||
|
||||
private fun KtSecondaryConstructor.toFirConstructor(
|
||||
delegatedSuperTypeRef: FirTypeRef,
|
||||
delegatedSelfTypeRef: FirTypeRef,
|
||||
protected fun KtSecondaryConstructor.toFirConstructor(
|
||||
delegatedTypeRef: FirTypeRef,
|
||||
selfTypeRef: FirTypeRef,
|
||||
owner: KtClassOrObject,
|
||||
ownerTypeParameters: List<FirTypeParameterRef>
|
||||
): FirConstructor {
|
||||
@@ -1552,7 +1598,7 @@ open class RawFirBuilder(
|
||||
source = this@toFirConstructor.toFirSourceElement()
|
||||
moduleData = baseModuleData
|
||||
origin = FirDeclarationOrigin.Source
|
||||
returnTypeRef = delegatedSelfTypeRef
|
||||
returnTypeRef = selfTypeRef
|
||||
val explicitVisibility = visibility
|
||||
status = FirDeclarationStatusImpl(explicitVisibility, Modality.FINAL).apply {
|
||||
isExpect = hasExpectModifier() || this@RawFirBuilder.context.containerIsExpect
|
||||
@@ -1563,10 +1609,12 @@ open class RawFirBuilder(
|
||||
}
|
||||
dispatchReceiverType = owner.obtainDispatchReceiverForConstructor()
|
||||
symbol = FirConstructorSymbol(callableIdForClassConstructor())
|
||||
delegatedConstructor = getDelegationCall().convert(
|
||||
delegatedSuperTypeRef,
|
||||
delegatedSelfTypeRef,
|
||||
)
|
||||
delegatedConstructor = buildOrLazyDelegatedConstructorCall(
|
||||
isThis = isDelegatedCallToThis(),
|
||||
constructedTypeRef = delegatedTypeRef,
|
||||
) {
|
||||
getDelegationCall().convert(delegatedTypeRef)
|
||||
}
|
||||
this@RawFirBuilder.context.firFunctionTargets += target
|
||||
extractAnnotationsTo(this)
|
||||
typeParameters += constructorTypeParametersFromConstructedClass(ownerTypeParameters)
|
||||
@@ -1583,8 +1631,7 @@ open class RawFirBuilder(
|
||||
}
|
||||
|
||||
private fun KtConstructorDelegationCall.convert(
|
||||
delegatedSuperTypeRef: FirTypeRef,
|
||||
delegatedSelfTypeRef: FirTypeRef,
|
||||
delegatedType: FirTypeRef,
|
||||
): FirDelegatedConstructorCall {
|
||||
val isThis = isCallToThis //|| (isImplicit && hasPrimaryConstructor)
|
||||
val source = if (isImplicit) {
|
||||
@@ -1592,10 +1639,6 @@ open class RawFirBuilder(
|
||||
} else {
|
||||
this.toFirSourceElement()
|
||||
}
|
||||
val delegatedType = when {
|
||||
isThis -> delegatedSelfTypeRef
|
||||
else -> delegatedSuperTypeRef
|
||||
}
|
||||
return buildDelegatedConstructorCall {
|
||||
this.source = source
|
||||
constructedTypeRef = delegatedType.copyWithNewSourceKind(KtFakeSourceElementKind.ImplicitTypeRef)
|
||||
@@ -1619,7 +1662,7 @@ open class RawFirBuilder(
|
||||
}
|
||||
|
||||
private fun KtDeclarationWithInitializer.toInitializerExpression() =
|
||||
runIf (hasInitializer()) {
|
||||
runIf(hasInitializer()) {
|
||||
buildOrLazyExpression(initializer?.toFirSourceElement()) {
|
||||
initializer.toFirExpression("Should have initializer")
|
||||
}
|
||||
|
||||
+2
-2
@@ -13,14 +13,14 @@ FILE: annotation.kt
|
||||
}
|
||||
@base() public? final? class correct : R|kotlin/Any| {
|
||||
public? constructor(@base() x: Int): R|correct| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
@base() public? final? val x: Int = R|<local>/x|
|
||||
public? get(): Int
|
||||
|
||||
@base() public? constructor(): R|correct| {
|
||||
this<R|correct|>(IntegerLiteral(0))
|
||||
LAZY_this<R|correct|>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
||||
FILE: constructorInObject.kt
|
||||
public? final? object A : R|kotlin/Any| {
|
||||
public? constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
init { LAZY_BLOCK }
|
||||
@@ -30,7 +30,7 @@ FILE: constructorInObject.kt
|
||||
|
||||
public? final? companion object Companion : R|kotlin/Any| {
|
||||
public? constructor(): R|C.Companion| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ FILE: propertyAccessorsContractDescription.kt
|
||||
}
|
||||
public? final? class AnotherClass : R|kotlin/Any| {
|
||||
public? constructor(multiplier: Int): R|AnotherClass| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? var anotherInt: Int = LAZY_EXPRESSION
|
||||
@@ -33,7 +33,7 @@ FILE: propertyAccessorsContractDescription.kt
|
||||
}
|
||||
public? final? class SomeClass : R|kotlin/Any| {
|
||||
public? constructor(multiplier: Int?): R|SomeClass| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? var someInt: Int = LAZY_EXPRESSION
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
FILE: derivedClass.kt
|
||||
public? open class Base<T> : R|kotlin/Any| {
|
||||
public? constructor<T>(x: T): R|Base<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? val x: T = R|<local>/x|
|
||||
@@ -10,7 +10,7 @@ FILE: derivedClass.kt
|
||||
}
|
||||
public? final? class Derived<T : Any> : Base<T> {
|
||||
public? constructor<T : Any>(x: T): R|Derived<T>| {
|
||||
super<Base<T>>(x#)
|
||||
LAZY_super<Base<T>>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ FILE: enums.kt
|
||||
}
|
||||
public? final? enum class Planet : R|kotlin/Enum<Planet>| {
|
||||
private constructor(m: Double, r: Double): R|Planet| {
|
||||
super<R|kotlin/Enum<Planet>|>()
|
||||
LAZY_super<R|kotlin/Enum<Planet>|>
|
||||
}
|
||||
|
||||
public? final? val m: Double = R|<local>/m|
|
||||
@@ -58,7 +58,7 @@ FILE: enums.kt
|
||||
}
|
||||
public? final? enum class PseudoInsn : R|kotlin/Enum<PseudoInsn>| {
|
||||
private constructor(signature: String = String(()V)): R|PseudoInsn| {
|
||||
super<R|kotlin/Enum<PseudoInsn>|>()
|
||||
LAZY_super<R|kotlin/Enum<PseudoInsn>|>
|
||||
}
|
||||
|
||||
public? final? val signature: String = R|<local>/signature|
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ FILE: enums2.kt
|
||||
}
|
||||
public? final? enum class SomeEnum : R|kotlin/Enum<SomeEnum>| {
|
||||
private constructor(x: Some): R|SomeEnum| {
|
||||
super<R|kotlin/Enum<SomeEnum>|>()
|
||||
LAZY_super<R|kotlin/Enum<SomeEnum>|>
|
||||
}
|
||||
|
||||
public? final? val x: Some = R|<local>/x|
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
FILE: nestedClass.kt
|
||||
public? abstract class Base : R|kotlin/Any| {
|
||||
public? constructor(s: String): R|Base| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? val s: String = R|<local>/s|
|
||||
@@ -15,7 +15,7 @@ FILE: nestedClass.kt
|
||||
|
||||
public? final? class Derived : Base {
|
||||
public? constructor(s: String): R|Outer.Derived| {
|
||||
super<Base>(s#)
|
||||
LAZY_super<Base>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
FILE: noParameterTypRefInPrimaryConstructor.kt
|
||||
public? final? class X : R|kotlin/Any| {
|
||||
public? constructor(x: <ERROR TYPE REF: No type for parameter>): R|X| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
FILE: noParameterTypRefInPrimaryConsturctorVal.kt
|
||||
public? final? class X : R|kotlin/Any| {
|
||||
public? constructor(x: <ERROR TYPE REF: No type for parameter>): R|X| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? val x: <ERROR TYPE REF: No type for parameter> = R|<local>/x|
|
||||
|
||||
+1
-3
@@ -1,7 +1,5 @@
|
||||
FILE: noParameterTypRefInSecondaryConstructor.kt
|
||||
public? final? class C : R|kotlin/Any| {
|
||||
public? constructor(x: <ERROR TYPE REF: No type for parameter>): R|C| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
public? constructor(x: <ERROR TYPE REF: No type for parameter>): R|C| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
|
||||
Vendored
+2
-5
@@ -3,13 +3,10 @@ FILE: noPrimaryConstructor.kt
|
||||
public? final? val x: String
|
||||
public? get(): String
|
||||
|
||||
public? constructor(x: String): R|NoPrimary| {
|
||||
super<R|kotlin/Any|>()
|
||||
this#.x# = x#
|
||||
}
|
||||
public? constructor(x: String): R|NoPrimary| { LAZY_BLOCK }
|
||||
|
||||
public? constructor(): R|NoPrimary| {
|
||||
this<R|NoPrimary|>(String())
|
||||
LAZY_this<R|NoPrimary|>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ FILE: annotated.kt
|
||||
public? final? fun foo(arg: Int): Int { LAZY_BLOCK }
|
||||
public? final? data class Two : R|kotlin/Any| {
|
||||
public? constructor(x: Int, y: Int): R|Two| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? val x: Int = R|<local>/x|
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ FILE: arrayAccess.kt
|
||||
public? final? fun foo(): <implicit> { LAZY_BLOCK }
|
||||
public? final? class Wrapper : R|kotlin/Any| {
|
||||
public? constructor(v: IntArray): R|Wrapper| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? val v: IntArray = R|<local>/v|
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ FILE: calls.kt
|
||||
public? final? fun testRegular(): Int { LAZY_BLOCK }
|
||||
public? final? class My : R|kotlin/Any| {
|
||||
public? constructor(x: Int): R|My| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? var x: Int = R|<local>/x|
|
||||
|
||||
Vendored
+3
-3
@@ -1,7 +1,7 @@
|
||||
FILE: collectionLiterals.kt
|
||||
public? final? annotation class Ann1 : R|kotlin/Annotation| {
|
||||
public? constructor(arr: IntArray): R|Ann1| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? val arr: IntArray = R|<local>/arr|
|
||||
@@ -10,7 +10,7 @@ FILE: collectionLiterals.kt
|
||||
}
|
||||
public? final? annotation class Ann2 : R|kotlin/Annotation| {
|
||||
public? constructor(arr: DoubleArray): R|Ann2| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? val arr: DoubleArray = R|<local>/arr|
|
||||
@@ -19,7 +19,7 @@ FILE: collectionLiterals.kt
|
||||
}
|
||||
public? final? annotation class Ann3 : R|kotlin/Annotation| {
|
||||
public? constructor(arr: Array<String>): R|Ann3| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? val arr: Array<String> = R|<local>/arr|
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
FILE: destructuring.kt
|
||||
public? final? data class Some : R|kotlin/Any| {
|
||||
public? constructor(first: Int, second: Double, third: String): R|Some| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? val first: Int = R|<local>/first|
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ FILE: for.kt
|
||||
public? final? fun bar(list: List<String>): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? data class Some : R|kotlin/Any| {
|
||||
public? constructor(x: Int, y: Int): R|Some| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? val x: Int = R|<local>/x|
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
FILE: init.kt
|
||||
public? final? class WithInit : R|kotlin/Any| {
|
||||
public? constructor(x: Int): R|WithInit| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? val x: Int
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
FILE: lambda.kt
|
||||
public? final? data class Tuple : R|kotlin/Any| {
|
||||
public? constructor(x: Int, y: Int): R|Tuple| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? val x: Int = R|<local>/x|
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ FILE: unary.kt
|
||||
public? final? fun test(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? class X : R|kotlin/Any| {
|
||||
public? constructor(i: Int): R|X| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? val i: Int = R|<local>/i|
|
||||
@@ -13,7 +13,7 @@ FILE: unary.kt
|
||||
public? final? fun test3(arr: Array<Int>): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
public? final? class Y : R|kotlin/Any| {
|
||||
public? constructor(arr: Array<Int>): R|Y| {
|
||||
super<R|kotlin/Any|>()
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public? final? val arr: Array<Int> = R|<local>/arr|
|
||||
|
||||
@@ -65,6 +65,8 @@ abstract class FirConstructor : FirFunction(), FirTypeParameterRefsOwner {
|
||||
|
||||
abstract override fun replaceValueParameters(newValueParameters: List<FirValueParameter>)
|
||||
|
||||
abstract fun replaceDelegatedConstructor(newDelegatedConstructor: FirDelegatedConstructorCall?)
|
||||
|
||||
abstract override fun replaceBody(newBody: FirBlock?)
|
||||
|
||||
abstract override fun <D> transformTypeParameters(transformer: FirTransformer<D>, data: D): FirConstructor
|
||||
|
||||
@@ -159,6 +159,10 @@ internal class FirConstructorImpl(
|
||||
valueParameters.addAll(newValueParameters)
|
||||
}
|
||||
|
||||
override fun replaceDelegatedConstructor(newDelegatedConstructor: FirDelegatedConstructorCall?) {
|
||||
delegatedConstructor = newDelegatedConstructor
|
||||
}
|
||||
|
||||
override fun replaceBody(newBody: FirBlock?) {
|
||||
body = newBody
|
||||
}
|
||||
|
||||
+4
@@ -160,6 +160,10 @@ class FirPrimaryConstructor @FirImplementationDetail constructor(
|
||||
valueParameters.addAll(newValueParameters)
|
||||
}
|
||||
|
||||
override fun replaceDelegatedConstructor(newDelegatedConstructor: FirDelegatedConstructorCall?) {
|
||||
delegatedConstructor = newDelegatedConstructor
|
||||
}
|
||||
|
||||
override fun replaceBody(newBody: FirBlock?) {
|
||||
body = newBody
|
||||
}
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress("DuplicatedCode")
|
||||
|
||||
package org.jetbrains.kotlin.fir.expressions.builder
|
||||
|
||||
import kotlin.contracts.*
|
||||
import org.jetbrains.kotlin.KtSourceElement
|
||||
import org.jetbrains.kotlin.fir.FirImplementationDetail
|
||||
import org.jetbrains.kotlin.fir.builder.FirAnnotationContainerBuilder
|
||||
import org.jetbrains.kotlin.fir.builder.FirBuilderDsl
|
||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
|
||||
import org.jetbrains.kotlin.fir.expressions.FirArgumentList
|
||||
import org.jetbrains.kotlin.fir.expressions.FirDelegatedConstructorCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.impl.FirLazyDelegatedConstructorCall
|
||||
import org.jetbrains.kotlin.fir.references.FirReference
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
* DO NOT MODIFY IT MANUALLY
|
||||
*/
|
||||
|
||||
@FirBuilderDsl
|
||||
class FirLazyDelegatedConstructorCallBuilder : FirAnnotationContainerBuilder {
|
||||
lateinit var constructedTypeRef: FirTypeRef
|
||||
lateinit var calleeReference: FirReference
|
||||
var isThis: Boolean by kotlin.properties.Delegates.notNull<Boolean>()
|
||||
|
||||
@OptIn(FirImplementationDetail::class)
|
||||
override fun build(): FirDelegatedConstructorCall {
|
||||
return FirLazyDelegatedConstructorCall(
|
||||
constructedTypeRef,
|
||||
calleeReference,
|
||||
isThis,
|
||||
)
|
||||
}
|
||||
|
||||
@Deprecated("Modification of 'source' has no impact for FirLazyDelegatedConstructorCallBuilder", level = DeprecationLevel.HIDDEN)
|
||||
override var source: KtSourceElement?
|
||||
get() = throw IllegalStateException()
|
||||
set(_) {
|
||||
throw IllegalStateException()
|
||||
}
|
||||
|
||||
@Deprecated("Modification of 'annotations' has no impact for FirLazyDelegatedConstructorCallBuilder", level = DeprecationLevel.HIDDEN)
|
||||
override val annotations: MutableList<FirAnnotation> = mutableListOf()
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
inline fun buildLazyDelegatedConstructorCall(init: FirLazyDelegatedConstructorCallBuilder.() -> Unit): FirDelegatedConstructorCall {
|
||||
contract {
|
||||
callsInPlace(init, kotlin.contracts.InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
return FirLazyDelegatedConstructorCallBuilder().apply(init).build()
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress("DuplicatedCode")
|
||||
|
||||
package org.jetbrains.kotlin.fir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.KtSourceElement
|
||||
import org.jetbrains.kotlin.fir.FirImplementationDetail
|
||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
|
||||
import org.jetbrains.kotlin.fir.expressions.FirArgumentList
|
||||
import org.jetbrains.kotlin.fir.expressions.FirDelegatedConstructorCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.references.FirReference
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
* DO NOT MODIFY IT MANUALLY
|
||||
*/
|
||||
|
||||
class FirLazyDelegatedConstructorCall @FirImplementationDetail constructor(
|
||||
override var constructedTypeRef: FirTypeRef,
|
||||
override var calleeReference: FirReference,
|
||||
override val isThis: Boolean,
|
||||
) : FirDelegatedConstructorCall() {
|
||||
override val source: KtSourceElement? get() = error("FirLazyDelegatedConstructorCall should be calculated before accessing")
|
||||
override val annotations: List<FirAnnotation> get() = error("FirLazyDelegatedConstructorCall should be calculated before accessing")
|
||||
override val argumentList: FirArgumentList get() = error("FirLazyDelegatedConstructorCall should be calculated before accessing")
|
||||
override val contextReceiverArguments: List<FirExpression> get() = error("FirLazyDelegatedConstructorCall should be calculated before accessing")
|
||||
override val dispatchReceiver: FirExpression get() = error("FirLazyDelegatedConstructorCall should be calculated before accessing")
|
||||
override val isSuper: Boolean get() = !isThis
|
||||
|
||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||
constructedTypeRef.accept(visitor, data)
|
||||
calleeReference.accept(visitor, data)
|
||||
}
|
||||
|
||||
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirLazyDelegatedConstructorCall {
|
||||
constructedTypeRef = constructedTypeRef.transform(transformer, data)
|
||||
transformCalleeReference(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirLazyDelegatedConstructorCall {
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformDispatchReceiver(transformer: FirTransformer<D>, data: D): FirLazyDelegatedConstructorCall {
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformCalleeReference(transformer: FirTransformer<D>, data: D): FirLazyDelegatedConstructorCall {
|
||||
calleeReference = calleeReference.transform(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun replaceArgumentList(newArgumentList: FirArgumentList) {}
|
||||
|
||||
override fun replaceContextReceiverArguments(newContextReceiverArguments: List<FirExpression>) {}
|
||||
|
||||
override fun replaceConstructedTypeRef(newConstructedTypeRef: FirTypeRef) {
|
||||
constructedTypeRef = newConstructedTypeRef
|
||||
}
|
||||
|
||||
override fun replaceCalleeReference(newCalleeReference: FirReference) {
|
||||
calleeReference = newCalleeReference
|
||||
}
|
||||
}
|
||||
@@ -654,10 +654,15 @@ class FirRenderer(
|
||||
}
|
||||
|
||||
override fun visitDelegatedConstructorCall(delegatedConstructorCall: FirDelegatedConstructorCall) {
|
||||
val dispatchReceiver = delegatedConstructorCall.dispatchReceiver
|
||||
if (dispatchReceiver !is FirNoReceiverExpression) {
|
||||
dispatchReceiver.accept(this)
|
||||
print(".")
|
||||
if (delegatedConstructorCall !is FirLazyDelegatedConstructorCall) {
|
||||
val dispatchReceiver = delegatedConstructorCall.dispatchReceiver
|
||||
if (dispatchReceiver !is FirNoReceiverExpression) {
|
||||
dispatchReceiver.accept(this)
|
||||
print(".")
|
||||
}
|
||||
}
|
||||
if (delegatedConstructorCall is FirLazyDelegatedConstructorCall) {
|
||||
print("LAZY_")
|
||||
}
|
||||
if (delegatedConstructorCall.isSuper) {
|
||||
print("super<")
|
||||
@@ -666,7 +671,9 @@ class FirRenderer(
|
||||
}
|
||||
delegatedConstructorCall.constructedTypeRef.accept(this)
|
||||
print(">")
|
||||
visitCall(delegatedConstructorCall)
|
||||
if (delegatedConstructorCall !is FirLazyDelegatedConstructorCall) {
|
||||
visitCall(delegatedConstructorCall)
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitTypeRef(typeRef: FirTypeRef) {
|
||||
|
||||
+1
-1
@@ -190,7 +190,7 @@ object BuilderConfigurator : AbstractBuilderConfigurator<FirTreeBuilder>(FirTree
|
||||
defaultNull("label")
|
||||
}
|
||||
|
||||
builder(delegatedConstructorCall) {
|
||||
builder(delegatedConstructorCall, type = "FirDelegatedConstructorCallImpl") {
|
||||
parents += callBuilder
|
||||
default("argumentList") {
|
||||
value = "FirEmptyArgumentList"
|
||||
|
||||
+29
@@ -128,6 +128,35 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
||||
useTypes(explicitThisReferenceType, explicitSuperReferenceType)
|
||||
}
|
||||
|
||||
impl(delegatedConstructorCall, "FirLazyDelegatedConstructorCall") {
|
||||
val error = """error("FirLazyDelegatedConstructorCall should be calculated before accessing")"""
|
||||
default("source") {
|
||||
value = error
|
||||
withGetter = true
|
||||
}
|
||||
default("annotations") {
|
||||
value = error
|
||||
withGetter = true
|
||||
}
|
||||
default("argumentList") {
|
||||
value = error
|
||||
withGetter = true
|
||||
}
|
||||
default("contextReceiverArguments") {
|
||||
value = error
|
||||
withGetter = true
|
||||
}
|
||||
default("dispatchReceiver") {
|
||||
value = error
|
||||
withGetter = true
|
||||
}
|
||||
default("isSuper") {
|
||||
value = "!isThis"
|
||||
withGetter = true
|
||||
}
|
||||
publicImplementation()
|
||||
}
|
||||
|
||||
impl(expression, "FirElseIfTrueCondition") {
|
||||
defaultTypeRefWithSource("FirImplicitBooleanTypeRef")
|
||||
useTypes(implicitBooleanTypeRefType)
|
||||
|
||||
+1
-1
@@ -379,7 +379,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
constructor.configure {
|
||||
+annotations
|
||||
+symbol("FirConstructorSymbol")
|
||||
+field("delegatedConstructor", delegatedConstructorCall, nullable = true).withTransform()
|
||||
+field("delegatedConstructor", delegatedConstructorCall, nullable = true, withReplace = true).withTransform()
|
||||
+body(nullable = true)
|
||||
+booleanField("isPrimary")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user