[FIR] Set delegate field receiver properly
This commit is contained in:
+4
-4
@@ -42,18 +42,18 @@ FILE: delegateInference.kt
|
||||
|
||||
public final var x: R|kotlin/Boolean|by R|/FreezableVar.FreezableVar|<R|kotlin/Boolean|>(Boolean(true))
|
||||
public get(): R|kotlin/Boolean| {
|
||||
^ D|/Test.x|.R|FakeOverride</FreezableVar.getValue: R|kotlin/Boolean|>|(this@R|/Test|, ::R|/Test.x|)
|
||||
^ this@R|/Test|.D|/Test.x|.R|FakeOverride</FreezableVar.getValue: R|kotlin/Boolean|>|(this@R|/Test|, ::R|/Test.x|)
|
||||
}
|
||||
public set(<set-?>: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
D|/Test.x|.R|FakeOverride</FreezableVar.setValue: R|kotlin/Unit|>|(this@R|/Test|, ::R|/Test.x|, R|<local>/x|)
|
||||
this@R|/Test|.D|/Test.x|.R|FakeOverride</FreezableVar.setValue: R|kotlin/Unit|>|(this@R|/Test|, ::R|/Test.x|, R|<local>/x|)
|
||||
}
|
||||
|
||||
public final var y: R|kotlin/String|by R|/FreezableVar.FreezableVar|<R|kotlin/String|>(String())
|
||||
public get(): R|kotlin/String| {
|
||||
^ D|/Test.y|.R|FakeOverride</FreezableVar.getValue: R|kotlin/String|>|(this@R|/Test|, ::R|/Test.y|)
|
||||
^ this@R|/Test|.D|/Test.y|.R|FakeOverride</FreezableVar.getValue: R|kotlin/String|>|(this@R|/Test|, ::R|/Test.y|)
|
||||
}
|
||||
public set(<set-?>: R|kotlin/String|): R|kotlin/Unit| {
|
||||
D|/Test.y|.R|FakeOverride</FreezableVar.setValue: R|kotlin/Unit|>|(this@R|/Test|, ::R|/Test.y|, R|<local>/y|)
|
||||
this@R|/Test|.D|/Test.y|.R|FakeOverride</FreezableVar.setValue: R|kotlin/Unit|>|(this@R|/Test|, ::R|/Test.y|, R|<local>/y|)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ FILE: delegateWithLambda.kt
|
||||
}
|
||||
)
|
||||
public get(): R|kotlin/String| {
|
||||
^ D|/Test.x|.R|FakeOverride</LazyDelegate.getValue: R|kotlin/String|>|(this@R|/Test|, ::R|/Test.x|)
|
||||
^ this@R|/Test|.D|/Test.x|.R|FakeOverride</LazyDelegate.getValue: R|kotlin/String|>|(this@R|/Test|, ::R|/Test.x|)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ FILE: provideDelegate.kt
|
||||
|
||||
public final val x: R|kotlin/Int|by R|/delegate|<R|kotlin/Int|>(Int(1)).R|FakeOverride</DelegateProvider.provideDelegate: R|Delegate<kotlin/Int>|>|(this@R|/A|, ::R|/A.x|)
|
||||
public get(): R|kotlin/Int| {
|
||||
^ D|/A.x|.R|FakeOverride</Delegate.getValue: R|kotlin/Int|>|(this@R|/A|, ::R|/A.x|)
|
||||
^ this@R|/A|.D|/A.x|.R|FakeOverride</Delegate.getValue: R|kotlin/Int|>|(this@R|/A|, ::R|/A.x|)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-4
@@ -35,10 +35,10 @@ FILE: delegateTypeMismatch.kt
|
||||
|
||||
public final var classifierNamePolicy: R|ClassifierNamePolicy|by this@R|/A|.R|/A.property|<R|ClassifierNamePolicy|>(Q|ClassifierNamePolicy.SOURCE_CODE_QUALIFIED|)
|
||||
public get(): R|ClassifierNamePolicy| {
|
||||
^ D|/A.classifierNamePolicy|.R|FakeOverride<kotlin/properties/ReadWriteProperty.getValue: R|ClassifierNamePolicy|>|(this@R|/A|, ::R|/A.classifierNamePolicy|)
|
||||
^ this@R|/A|.D|/A.classifierNamePolicy|.R|FakeOverride<kotlin/properties/ReadWriteProperty.getValue: R|ClassifierNamePolicy|>|(this@R|/A|, ::R|/A.classifierNamePolicy|)
|
||||
}
|
||||
public set(<set-?>: R|ClassifierNamePolicy|): R|kotlin/Unit| {
|
||||
D|/A.classifierNamePolicy|.R|FakeOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(this@R|/A|, ::R|/A.classifierNamePolicy|, R|<local>/classifierNamePolicy|)
|
||||
this@R|/A|.D|/A.classifierNamePolicy|.R|FakeOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(this@R|/A|, ::R|/A.classifierNamePolicy|, R|<local>/classifierNamePolicy|)
|
||||
}
|
||||
|
||||
public final var typeNormalizer: R|(KotlinType) -> KotlinType|by this@R|/A|.R|/A.property|<R|(KotlinType) -> KotlinType|>(property@fun <anonymous>(it: R|KotlinType|): R|KotlinType| {
|
||||
@@ -46,10 +46,10 @@ FILE: delegateTypeMismatch.kt
|
||||
}
|
||||
)
|
||||
public get(): R|(KotlinType) -> KotlinType| {
|
||||
^ D|/A.typeNormalizer|.R|FakeOverride<kotlin/properties/ReadWriteProperty.getValue: R|(KotlinType) -> KotlinType|>|(this@R|/A|, ::R|/A.typeNormalizer|)
|
||||
^ this@R|/A|.D|/A.typeNormalizer|.R|FakeOverride<kotlin/properties/ReadWriteProperty.getValue: R|(KotlinType) -> KotlinType|>|(this@R|/A|, ::R|/A.typeNormalizer|)
|
||||
}
|
||||
public set(<set-?>: R|(KotlinType) -> KotlinType|): R|kotlin/Unit| {
|
||||
D|/A.typeNormalizer|.R|FakeOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(this@R|/A|, ::R|/A.typeNormalizer|, R|<local>/typeNormalizer|)
|
||||
this@R|/A|.D|/A.typeNormalizer|.R|FakeOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(this@R|/A|, ::R|/A.typeNormalizer|, R|<local>/typeNormalizer|)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -124,7 +124,7 @@ digraph delegateWithAnonymousObject_kt {
|
||||
50 [label="Access variable D|/IssuesListUserProfile.issueListView|"];
|
||||
51 [label="Access variable this@R|/IssuesListUserProfile|"];
|
||||
52 [label="Access variable R|<local>/issueListView|"];
|
||||
53 [label="Function call: D|/IssuesListUserProfile.issueListView|.R|FakeOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(...)"];
|
||||
53 [label="Function call: this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|FakeOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(...)"];
|
||||
49 [label="Exit function setter" style="filled" fillcolor=red];
|
||||
}
|
||||
subgraph cluster_13 {
|
||||
@@ -132,8 +132,8 @@ digraph delegateWithAnonymousObject_kt {
|
||||
41 [label="Enter function getter" style="filled" fillcolor=red];
|
||||
43 [label="Access variable D|/IssuesListUserProfile.issueListView|"];
|
||||
44 [label="Access variable this@R|/IssuesListUserProfile|"];
|
||||
45 [label="Function call: D|/IssuesListUserProfile.issueListView|.R|FakeOverride<kotlin/properties/ReadWriteProperty.getValue: R|IssueListView|>|(...)"];
|
||||
46 [label="Jump: ^ D|/IssuesListUserProfile.issueListView|.R|FakeOverride<kotlin/properties/ReadWriteProperty.getValue: R|IssueListView|>|(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|)"];
|
||||
45 [label="Function call: this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|FakeOverride<kotlin/properties/ReadWriteProperty.getValue: R|IssueListView|>|(...)"];
|
||||
46 [label="Jump: ^ this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|FakeOverride<kotlin/properties/ReadWriteProperty.getValue: R|IssueListView|>|(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|)"];
|
||||
47 [label="Stub" style="filled" fillcolor=gray];
|
||||
42 [label="Exit function getter" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -41,10 +41,10 @@ FILE: delegateWithAnonymousObject.kt
|
||||
}
|
||||
)
|
||||
public get(): R|IssueListView| {
|
||||
^ D|/IssuesListUserProfile.issueListView|.R|FakeOverride<kotlin/properties/ReadWriteProperty.getValue: R|IssueListView|>|(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|)
|
||||
^ this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|FakeOverride<kotlin/properties/ReadWriteProperty.getValue: R|IssueListView|>|(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|)
|
||||
}
|
||||
public set(<set-?>: R|IssueListView|): R|kotlin/Unit| {
|
||||
D|/IssuesListUserProfile.issueListView|.R|FakeOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|, R|<local>/issueListView|)
|
||||
this@R|/IssuesListUserProfile|.D|/IssuesListUserProfile.issueListView|.R|FakeOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|, R|<local>/issueListView|)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Vendored
+4
-4
@@ -15,10 +15,10 @@ FILE: propertyWithFunctionalType.kt
|
||||
}
|
||||
)
|
||||
public get(): R|(B) -> B| {
|
||||
^ D|/A.conventer|.R|FakeOverride<kotlin/properties/ReadWriteProperty.getValue: R|(B) -> B|>|(this@R|/A|, ::R|/A.conventer|)
|
||||
^ this@R|/A|.D|/A.conventer|.R|FakeOverride<kotlin/properties/ReadWriteProperty.getValue: R|(B) -> B|>|(this@R|/A|, ::R|/A.conventer|)
|
||||
}
|
||||
public set(<set-?>: R|(B) -> B|): R|kotlin/Unit| {
|
||||
D|/A.conventer|.R|FakeOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(this@R|/A|, ::R|/A.conventer|, R|<local>/conventer|)
|
||||
this@R|/A|.D|/A.conventer|.R|FakeOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(this@R|/A|, ::R|/A.conventer|, R|<local>/conventer|)
|
||||
}
|
||||
|
||||
public final var conventerWithExpectedType: R|(B) -> B|by this@R|/A|.R|/A.property|<R|(B) -> B|>(property@fun <anonymous>(it: R|B|): R|B| {
|
||||
@@ -26,10 +26,10 @@ FILE: propertyWithFunctionalType.kt
|
||||
}
|
||||
)
|
||||
public get(): R|(B) -> B| {
|
||||
^ D|/A.conventerWithExpectedType|.R|FakeOverride<kotlin/properties/ReadWriteProperty.getValue: R|(B) -> B|>|(this@R|/A|, ::R|/A.conventerWithExpectedType|)
|
||||
^ this@R|/A|.D|/A.conventerWithExpectedType|.R|FakeOverride<kotlin/properties/ReadWriteProperty.getValue: R|(B) -> B|>|(this@R|/A|, ::R|/A.conventerWithExpectedType|)
|
||||
}
|
||||
public set(<set-?>: R|(B) -> B|): R|kotlin/Unit| {
|
||||
D|/A.conventerWithExpectedType|.R|FakeOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(this@R|/A|, ::R|/A.conventerWithExpectedType|, R|<local>/conventerWithExpectedType|)
|
||||
this@R|/A|.D|/A.conventerWithExpectedType|.R|FakeOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(this@R|/A|, ::R|/A.conventerWithExpectedType|, R|<local>/conventerWithExpectedType|)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -9,10 +9,10 @@ FILE: simpleDelegatedToMap.kt
|
||||
|
||||
public final var foo: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>by R|<local>/map|
|
||||
public get(): <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]> {
|
||||
^ D|/C.foo|.<Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(this@R|/C|, ::R|/C.foo|)
|
||||
^ this@R|/C|.D|/C.foo|.<Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(this@R|/C|, ::R|/C.foo|)
|
||||
}
|
||||
public set(<set-?>: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>): R|kotlin/Unit| {
|
||||
D|/C.foo|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(this@R|/C|, ::R|/C.foo|, R|<local>/foo|)
|
||||
this@R|/C|.D|/C.foo|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(this@R|/C|, ::R|/C.foo|, R|<local>/foo|)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ FILE: simpleLazy.kt
|
||||
}
|
||||
)
|
||||
public get(): R|kotlin/String| {
|
||||
^ D|/Some.z|.R|kotlin/getValue|<R|kotlin/String|>(this@R|/Some|, ::R|/Some.z|)
|
||||
^ this@R|/Some|.D|/Some.z|.R|kotlin/getValue|<R|kotlin/String|>(this@R|/Some|, ::R|/Some.z|)
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
|
||||
+38
-24
@@ -11,29 +11,22 @@ import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
import org.jetbrains.kotlin.fir.declarations.FirProperty
|
||||
import org.jetbrains.kotlin.fir.declarations.FirVariable
|
||||
import org.jetbrains.kotlin.fir.declarations.builder.FirPropertyBuilder
|
||||
import org.jetbrains.kotlin.fir.declarations.builder.buildProperty
|
||||
import org.jetbrains.kotlin.fir.declarations.builder.buildPropertyAccessor
|
||||
import org.jetbrains.kotlin.fir.declarations.builder.buildValueParameter
|
||||
import org.jetbrains.kotlin.fir.declarations.builder.*
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyAccessor
|
||||
import org.jetbrains.kotlin.fir.expressions.*
|
||||
import org.jetbrains.kotlin.fir.expressions.builder.*
|
||||
import org.jetbrains.kotlin.fir.expressions.impl.FirSingleExpressionBlock
|
||||
import org.jetbrains.kotlin.fir.expressions.impl.buildSingleExpressionBlock
|
||||
import org.jetbrains.kotlin.fir.references.builder.buildDelegateFieldReference
|
||||
import org.jetbrains.kotlin.fir.references.builder.buildExplicitThisReference
|
||||
import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference
|
||||
import org.jetbrains.kotlin.fir.references.builder.buildSimpleNamedReference
|
||||
import org.jetbrains.kotlin.fir.references.builder.*
|
||||
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirDelegateFieldSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertyAccessorSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.constructStarProjectedType
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.types.ConeStarProjection
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.FirUserTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.builder.buildImplicitTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.builder.buildTypeProjectionWithVariance
|
||||
import org.jetbrains.kotlin.fir.types.builder.buildUserTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.impl.*
|
||||
@@ -298,31 +291,52 @@ fun generateTemporaryVariable(
|
||||
|
||||
fun FirPropertyBuilder.generateAccessorsByDelegate(
|
||||
delegateBuilder: FirWrappedDelegateExpressionBuilder?,
|
||||
ownerClassBuilder: FirClassBuilder?,
|
||||
session: FirSession,
|
||||
member: Boolean,
|
||||
extension: Boolean,
|
||||
isExtension: Boolean,
|
||||
stubMode: Boolean,
|
||||
receiver: FirExpression?
|
||||
|
||||
) {
|
||||
if (delegateBuilder == null) return
|
||||
val delegateFieldSymbol = FirDelegateFieldSymbol<FirProperty>(symbol.callableId).also {
|
||||
this.delegateFieldSymbol = it
|
||||
}
|
||||
val ownerSymbol = when (ownerClassBuilder) {
|
||||
is FirAnonymousObjectBuilder -> ownerClassBuilder.symbol
|
||||
is AbstractFirRegularClassBuilder -> ownerClassBuilder.symbol
|
||||
else -> null
|
||||
}
|
||||
val isMember = ownerSymbol != null
|
||||
|
||||
fun thisRef(): FirExpression =
|
||||
when {
|
||||
ownerSymbol != null -> buildThisReceiverExpression {
|
||||
source = delegateBuilder.source
|
||||
calleeReference = buildImplicitThisReference {
|
||||
boundSymbol = ownerSymbol
|
||||
}
|
||||
typeRef = buildResolvedTypeRef {
|
||||
val typeParameterNumber = (ownerClassBuilder as? AbstractFirRegularClassBuilder)?.typeParameters?.size ?: 0
|
||||
type = ownerSymbol.constructStarProjectedType(typeParameterNumber)
|
||||
}
|
||||
}
|
||||
// ???
|
||||
isExtension -> buildQualifiedAccessExpression {
|
||||
source = delegateBuilder.source
|
||||
calleeReference = buildExplicitThisReference {}
|
||||
}
|
||||
else -> buildConstExpression(null, FirConstKind.Null, null)
|
||||
}
|
||||
|
||||
fun delegateAccess() = buildQualifiedAccessExpression {
|
||||
source = delegateBuilder.source
|
||||
calleeReference = buildDelegateFieldReference {
|
||||
resolvedSymbol = delegateFieldSymbol
|
||||
}
|
||||
}
|
||||
|
||||
fun thisRef(): FirExpression =
|
||||
if (member || extension) buildQualifiedAccessExpression {
|
||||
source = delegateBuilder.source
|
||||
calleeReference = buildExplicitThisReference {}
|
||||
if (ownerSymbol != null) {
|
||||
dispatchReceiver = thisRef()
|
||||
}
|
||||
else buildConstExpression(null, FirConstKind.Null, null)
|
||||
}
|
||||
|
||||
val isVar = this@generateAccessorsByDelegate.isVar
|
||||
fun propertyRef() = buildCallableReferenceAccess {
|
||||
@@ -333,12 +347,12 @@ fun FirPropertyBuilder.generateAccessorsByDelegate(
|
||||
resolvedSymbol = this@generateAccessorsByDelegate.symbol
|
||||
}
|
||||
typeRef = when {
|
||||
!member && !extension -> if (isVar) {
|
||||
!isMember && !isExtension -> if (isVar) {
|
||||
FirImplicitKMutableProperty0TypeRef(null, ConeStarProjection)
|
||||
} else {
|
||||
FirImplicitKProperty0TypeRef(null, ConeStarProjection)
|
||||
}
|
||||
member && extension -> if (isVar) {
|
||||
isMember && isExtension -> if (isVar) {
|
||||
FirImplicitKMutableProperty2TypeRef(null, ConeStarProjection, ConeStarProjection, ConeStarProjection)
|
||||
} else {
|
||||
FirImplicitKProperty2TypeRef(null, ConeStarProjection, ConeStarProjection, ConeStarProjection)
|
||||
|
||||
+18
-14
@@ -429,12 +429,13 @@ class DeclarationsConverter(
|
||||
|
||||
val secondaryConstructors = classBody.getChildNodesByType(SECONDARY_CONSTRUCTOR)
|
||||
val classWrapper = ClassWrapper(
|
||||
className, modifiers, classKind, primaryConstructor != null,
|
||||
secondaryConstructors.isNotEmpty(),
|
||||
if (primaryConstructor != null) !primaryConstructor!!.hasValueParameters()
|
||||
className, modifiers, classKind, classBuilder,
|
||||
hasPrimaryConstructor = primaryConstructor != null,
|
||||
hasSecondaryConstructor = secondaryConstructors.isNotEmpty(),
|
||||
hasDefaultConstructor = if (primaryConstructor != null) !primaryConstructor!!.hasValueParameters()
|
||||
else secondaryConstructors.isEmpty() || secondaryConstructors.any { !it.hasValueParameters() },
|
||||
selfType,
|
||||
delegatedSuperTypeRef ?: defaultDelegatedSuperTypeRef, superTypeCallEntry
|
||||
delegatedSelfTypeRef = selfType,
|
||||
delegatedSuperTypeRef = delegatedSuperTypeRef ?: defaultDelegatedSuperTypeRef, superTypeCallEntry = superTypeCallEntry
|
||||
)
|
||||
//parse primary constructor
|
||||
val primaryConstructorWrapper = convertPrimaryConstructor(primaryConstructor, classWrapper, delegatedConstructorSource)
|
||||
@@ -517,7 +518,8 @@ class DeclarationsConverter(
|
||||
typeRef = delegatedSelfType
|
||||
|
||||
val classWrapper = ClassWrapper(
|
||||
SpecialNames.NO_NAME_PROVIDED, modifiers, ClassKind.OBJECT, hasPrimaryConstructor = false,
|
||||
SpecialNames.NO_NAME_PROVIDED, modifiers, ClassKind.OBJECT, this,
|
||||
hasPrimaryConstructor = false,
|
||||
hasSecondaryConstructor = classBody.getChildNodesByType(SECONDARY_CONSTRUCTOR).isNotEmpty(),
|
||||
hasDefaultConstructor = false,
|
||||
delegatedSelfTypeRef = delegatedSelfType,
|
||||
@@ -576,7 +578,8 @@ class DeclarationsConverter(
|
||||
symbol = FirAnonymousObjectSymbol()
|
||||
annotations += modifiers.annotations
|
||||
val enumClassWrapper = ClassWrapper(
|
||||
enumEntryName, modifiers, ClassKind.ENUM_ENTRY, hasPrimaryConstructor = true,
|
||||
enumEntryName, modifiers, ClassKind.ENUM_ENTRY, this,
|
||||
hasPrimaryConstructor = true,
|
||||
hasSecondaryConstructor = classBodyNode.getChildNodesByType(SECONDARY_CONSTRUCTOR).isNotEmpty(),
|
||||
hasDefaultConstructor = false,
|
||||
delegatedSelfTypeRef = buildResolvedTypeRef {
|
||||
@@ -623,7 +626,7 @@ class DeclarationsConverter(
|
||||
ENUM_ENTRY -> container += convertEnumEntry(node, classWrapper)
|
||||
CLASS -> container += convertClass(node)
|
||||
FUN -> container += convertFunctionDeclaration(node)
|
||||
PROPERTY -> container += convertPropertyDeclaration(node)
|
||||
PROPERTY -> container += convertPropertyDeclaration(node, classWrapper)
|
||||
TYPEALIAS -> container += convertTypeAlias(node)
|
||||
OBJECT_DECLARATION -> container += convertClass(node)
|
||||
CLASS_INITIALIZER -> container += convertAnonymousInitializer(node) //anonymousInitializer
|
||||
@@ -820,7 +823,7 @@ class DeclarationsConverter(
|
||||
/**
|
||||
* @see org.jetbrains.kotlin.parsing.KotlinParsing.parseProperty
|
||||
*/
|
||||
fun convertPropertyDeclaration(property: LighterASTNode): FirDeclaration {
|
||||
fun convertPropertyDeclaration(property: LighterASTNode, classWrapper: ClassWrapper? = null): FirDeclaration {
|
||||
var modifiers = Modifier()
|
||||
var identifier: String? = null
|
||||
val firTypeParameters = mutableListOf<FirTypeParameter>()
|
||||
@@ -884,9 +887,9 @@ class DeclarationsConverter(
|
||||
}
|
||||
generateAccessorsByDelegate(
|
||||
delegateBuilder,
|
||||
classWrapper?.classBuilder,
|
||||
baseSession,
|
||||
member = false,
|
||||
extension = false,
|
||||
isExtension = false,
|
||||
stubMode,
|
||||
receiver
|
||||
)
|
||||
@@ -916,9 +919,10 @@ class DeclarationsConverter(
|
||||
expressionConverter.getAsFirExpression<FirExpression>(it, "Should have delegate")
|
||||
}
|
||||
generateAccessorsByDelegate(
|
||||
delegateBuilder, baseSession,
|
||||
member = parentNode?.tokenType != KT_FILE,
|
||||
extension = receiverType != null,
|
||||
delegateBuilder,
|
||||
classWrapper?.classBuilder,
|
||||
baseSession,
|
||||
isExtension = receiverType != null,
|
||||
stubMode,
|
||||
receiver
|
||||
)
|
||||
|
||||
+4
-1
@@ -9,8 +9,10 @@ import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.descriptors.Visibility
|
||||
import org.jetbrains.kotlin.fir.declarations.builder.FirClassBuilder
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.lightTree.fir.modifier.Modifier
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.name.SpecialNames
|
||||
@@ -19,12 +21,13 @@ class ClassWrapper(
|
||||
private val className: Name,
|
||||
private val modifiers: Modifier,
|
||||
private val classKind: ClassKind,
|
||||
val classBuilder: FirClassBuilder,
|
||||
val hasPrimaryConstructor: Boolean,
|
||||
val hasSecondaryConstructor: Boolean,
|
||||
val hasDefaultConstructor: Boolean,
|
||||
val delegatedSelfTypeRef: FirTypeRef,
|
||||
val delegatedSuperTypeRef: FirTypeRef,
|
||||
val superTypeCallEntry: MutableList<FirExpression>
|
||||
val superTypeCallEntry: MutableList<FirExpression>,
|
||||
) {
|
||||
fun isObjectLiteral(): Boolean {
|
||||
return className == SpecialNames.NO_NAME_PROVIDED && isObject()
|
||||
|
||||
+47
-34
@@ -156,7 +156,8 @@ class RawFirBuilder(
|
||||
convert()
|
||||
|
||||
private fun KtDeclaration.toFirDeclaration(
|
||||
delegatedSuperType: FirTypeRef, delegatedSelfType: FirResolvedTypeRef, owner: KtClassOrObject, hasPrimaryConstructor: Boolean,
|
||||
delegatedSuperType: FirTypeRef, delegatedSelfType: FirResolvedTypeRef,
|
||||
owner: KtClassOrObject, ownerClassBuilder: FirClassBuilder, hasPrimaryConstructor: Boolean,
|
||||
): FirDeclaration {
|
||||
return when (this) {
|
||||
is KtSecondaryConstructor -> {
|
||||
@@ -175,6 +176,9 @@ class RawFirBuilder(
|
||||
}
|
||||
toFirEnumEntry(delegatedSelfType, ownerClassHasDefaultConstructor)
|
||||
}
|
||||
is KtProperty -> {
|
||||
toFirProperty(ownerClassBuilder)
|
||||
}
|
||||
else -> convert()
|
||||
}
|
||||
}
|
||||
@@ -588,6 +592,7 @@ class RawFirBuilder(
|
||||
correctedEnumSelfTypeRef,
|
||||
delegatedSelfType = delegatedEntrySelfType,
|
||||
ktEnumEntry,
|
||||
ownerClassBuilder = this,
|
||||
hasPrimaryConstructor = true,
|
||||
)
|
||||
}
|
||||
@@ -651,7 +656,8 @@ class RawFirBuilder(
|
||||
for (declaration in classOrObject.declarations) {
|
||||
addDeclaration(
|
||||
declaration.toFirDeclaration(
|
||||
delegatedSuperType, delegatedSelfType, classOrObject, hasPrimaryConstructor = primaryConstructor != null,
|
||||
delegatedSuperType, delegatedSelfType, classOrObject, classBuilder,
|
||||
hasPrimaryConstructor = primaryConstructor != null,
|
||||
),
|
||||
)
|
||||
}
|
||||
@@ -696,6 +702,7 @@ class RawFirBuilder(
|
||||
delegatedSuperType,
|
||||
delegatedSelfType,
|
||||
owner = objectDeclaration,
|
||||
ownerClassBuilder = this,
|
||||
hasPrimaryConstructor = false,
|
||||
)
|
||||
}
|
||||
@@ -923,23 +930,15 @@ class RawFirBuilder(
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitAnonymousInitializer(initializer: KtAnonymousInitializer, data: Unit): FirElement {
|
||||
return buildAnonymousInitializer {
|
||||
source = initializer.toFirSourceElement()
|
||||
session = baseSession
|
||||
body = if (stubMode) buildEmptyExpressionBlock() else initializer.body.toFirBlock()
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitProperty(property: KtProperty, data: Unit): FirElement {
|
||||
val propertyType = property.typeReference.toFirOrImplicitType()
|
||||
val propertyName = property.nameAsSafeName
|
||||
val isVar = property.isVar
|
||||
val propertyInitializer = if (property.hasInitializer()) {
|
||||
{ property.initializer }.toFirExpression("Should have initializer")
|
||||
private fun KtProperty.toFirProperty(ownerClassBuilder: FirClassBuilder?): FirProperty {
|
||||
val propertyType = typeReference.toFirOrImplicitType()
|
||||
val propertyName = nameAsSafeName
|
||||
val isVar = isVar
|
||||
val propertyInitializer = if (hasInitializer()) {
|
||||
{ initializer }.toFirExpression("Should have initializer")
|
||||
} else null
|
||||
val delegateExpression by lazy { property.delegate?.expression }
|
||||
val propertySource = property.toFirSourceElement()
|
||||
val delegateExpression by lazy { delegate?.expression }
|
||||
val propertySource = toFirSourceElement()
|
||||
|
||||
return buildProperty {
|
||||
source = propertySource
|
||||
@@ -949,7 +948,7 @@ class RawFirBuilder(
|
||||
this.isVar = isVar
|
||||
initializer = propertyInitializer
|
||||
|
||||
if (property.isLocal) {
|
||||
if (this@toFirProperty.isLocal) {
|
||||
isLocal = true
|
||||
symbol = FirPropertySymbol(propertyName)
|
||||
val delegateBuilder = delegateExpression?.let {
|
||||
@@ -962,43 +961,57 @@ class RawFirBuilder(
|
||||
status = FirDeclarationStatusImpl(Visibilities.LOCAL, Modality.FINAL)
|
||||
|
||||
val receiver = delegateExpression?.toFirExpression("Incorrect delegate expression")
|
||||
generateAccessorsByDelegate(delegateBuilder, baseSession, member = false, extension = false, stubMode, receiver)
|
||||
generateAccessorsByDelegate(delegateBuilder, null, baseSession, isExtension = false, stubMode, receiver)
|
||||
} else {
|
||||
isLocal = false
|
||||
receiverTypeRef = property.receiverTypeReference.convertSafe()
|
||||
receiverTypeRef = receiverTypeReference.convertSafe()
|
||||
symbol = FirPropertySymbol(callableIdForName(propertyName))
|
||||
val delegateBuilder = if (property.hasDelegate()) {
|
||||
val delegateBuilder = if (hasDelegate()) {
|
||||
FirWrappedDelegateExpressionBuilder().apply {
|
||||
source = if (stubMode) null else delegateExpression?.toFirSourceElement()
|
||||
expression = { delegateExpression }.toFirExpression("Should have delegate")
|
||||
}
|
||||
} else null
|
||||
status = FirDeclarationStatusImpl(property.visibility, property.modality).apply {
|
||||
isExpect = property.hasExpectModifier()
|
||||
isActual = property.hasActualModifier()
|
||||
isOverride = property.hasModifier(OVERRIDE_KEYWORD)
|
||||
isConst = property.hasModifier(CONST_KEYWORD)
|
||||
isLateInit = property.hasModifier(LATEINIT_KEYWORD)
|
||||
status = FirDeclarationStatusImpl(visibility, modality).apply {
|
||||
isExpect = hasExpectModifier()
|
||||
isActual = hasActualModifier()
|
||||
isOverride = hasModifier(OVERRIDE_KEYWORD)
|
||||
isConst = hasModifier(CONST_KEYWORD)
|
||||
isLateInit = hasModifier(LATEINIT_KEYWORD)
|
||||
}
|
||||
property.extractTypeParametersTo(this)
|
||||
extractTypeParametersTo(this)
|
||||
|
||||
getter = property.getter.toFirPropertyAccessor(property, propertyType, isGetter = true)
|
||||
setter = if (isVar) property.setter.toFirPropertyAccessor(property, propertyType, isGetter = false) else null
|
||||
getter = this@toFirProperty.getter.toFirPropertyAccessor(this@toFirProperty, propertyType, isGetter = true)
|
||||
setter = if (isVar) {
|
||||
this@toFirProperty.setter.toFirPropertyAccessor(this@toFirProperty, propertyType, isGetter = false)
|
||||
} else null
|
||||
|
||||
val receiver = delegateExpression?.toFirExpression("Should have delegate")
|
||||
generateAccessorsByDelegate(
|
||||
delegateBuilder,
|
||||
ownerClassBuilder,
|
||||
baseSession,
|
||||
member = !property.isTopLevel,
|
||||
extension = property.receiverTypeReference != null,
|
||||
isExtension = receiverTypeReference != null,
|
||||
stubMode,
|
||||
receiver
|
||||
)
|
||||
}
|
||||
property.extractAnnotationsTo(this)
|
||||
extractAnnotationsTo(this)
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitAnonymousInitializer(initializer: KtAnonymousInitializer, data: Unit): FirElement {
|
||||
return buildAnonymousInitializer {
|
||||
source = initializer.toFirSourceElement()
|
||||
session = baseSession
|
||||
body = if (stubMode) buildEmptyExpressionBlock() else initializer.body.toFirBlock()
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitProperty(property: KtProperty, data: Unit): FirElement {
|
||||
return property.toFirProperty(ownerClassBuilder = null)
|
||||
}
|
||||
|
||||
override fun visitTypeReference(typeReference: KtTypeReference, data: Unit): FirElement {
|
||||
val typeElement = typeReference.typeElement
|
||||
val source = typeReference.toFirSourceElement()
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2010-2020 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.symbols
|
||||
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLookupTagWithFixedSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||
import org.jetbrains.kotlin.fir.types.ConeStarProjection
|
||||
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||
|
||||
fun FirClassSymbol<*>.constructStarProjectedType(typeParameterNumber: Int): ConeClassLikeType {
|
||||
return ConeClassLikeTypeImpl(
|
||||
if (classId.isLocal) ConeClassLookupTagWithFixedSymbol(classId, this)
|
||||
else ConeClassLikeLookupTagImpl(classId),
|
||||
Array(typeParameterNumber) { ConeStarProjection },
|
||||
isNullable = false
|
||||
)
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
val four: Int by NumberDecrypter
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// !API_VERSION: 1.3
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
// This test simply checks that we still generate correct calls to PropertyReference1Impl constructors for API version < 1.4,
|
||||
// where we added and started using new constructors which take j.l.Class+int instead of KDeclarationContainer.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class A {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
// See KT-10107: 'Variable must be initialized' for delegate with private set
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate<T>(var inner: T) {
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate<T>(var inner: T) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
interface T {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate(val value: String) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.properties.ReadOnlyProperty
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate<T>(val f: (T) -> Int) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
Vendored
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
class Foo {
|
||||
var a: Int = 42
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
class Foo {
|
||||
var a: Int = 42
|
||||
|
||||
Vendored
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
class Foo {
|
||||
companion object {
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
Vendored
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
object Foo {
|
||||
var a: Int = 42
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
class Foo {
|
||||
companion object {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.properties.ReadOnlyProperty
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class D {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Holder(var value: Int) {
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
// java.lang.VerifyError: (class: NotImplemented, method: get signature: (Ljava/lang/Object;Lkotlin/reflect/KProperty;)Ljava/lang/Object;) Unable to pop operand off an empty stack
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
@@ -109,7 +109,8 @@ FILE fqName:<root> fileName:/classLevelProperties.kt
|
||||
CALL 'public final fun getValue <T> (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): T of kotlin.getValue [inline,operator] declared in kotlin' type=kotlin.Int origin=null
|
||||
<T>: kotlin.Int
|
||||
$receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test7$delegate type:kotlin.Lazy<kotlin.Int> visibility:private [final]' type=kotlin.Lazy<kotlin.Int> origin=null
|
||||
thisRef: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
||||
receiver: GET_VAR '<this>: <root>.C declared in <root>.C.<get-test7>' type=<root>.C origin=null
|
||||
thisRef: GET_VAR '<this>: <root>.C declared in <root>.C.<get-test7>' type=<root>.C origin=null
|
||||
property: PROPERTY_REFERENCE 'public final test7: kotlin.Int [delegated,val]' field=null getter='public final fun <get-test7> (): kotlin.Int declared in <root>.C' setter=null type=kotlin.reflect.KProperty1<<root>.C, kotlin.Int> origin=PROPERTY_REFERENCE_FOR_DELEGATE
|
||||
PROPERTY name:test8 visibility:public modality:FINAL [delegated,var]
|
||||
FIELD PROPERTY_DELEGATE name:test8$delegate type:java.util.HashMap<kotlin.String, kotlin.Int> visibility:private [final]
|
||||
@@ -123,7 +124,7 @@ FILE fqName:<root> fileName:/classLevelProperties.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test8> (): IrErrorType declared in <root>.C'
|
||||
ERROR_CALL 'Unresolved reference: <Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#' type=IrErrorType
|
||||
GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
||||
GET_VAR '<this>: <root>.C declared in <root>.C.<get-test8>' type=<root>.C origin=null
|
||||
PROPERTY_REFERENCE 'public final test8: IrErrorType [delegated,var]' field=null getter='public final fun <get-test8> (): IrErrorType declared in <root>.C' setter='public final fun <set-test8> (<set-?>: IrErrorType): kotlin.Unit declared in <root>.C' type=kotlin.reflect.KMutableProperty1<*, *> origin=PROPERTY_REFERENCE_FOR_DELEGATE
|
||||
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-test8> visibility:public modality:FINAL <> ($this:<root>.C, <set-?>:IrErrorType) returnType:kotlin.Unit
|
||||
correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [delegated,var]
|
||||
@@ -131,7 +132,7 @@ FILE fqName:<root> fileName:/classLevelProperties.kt
|
||||
VALUE_PARAMETER name:<set-?> index:0 type:IrErrorType
|
||||
BLOCK_BODY
|
||||
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#' type=IrErrorType
|
||||
GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
||||
GET_VAR '<this>: <root>.C declared in <root>.C.<set-test8>' type=<root>.C origin=null
|
||||
PROPERTY_REFERENCE 'public final test8: IrErrorType [delegated,var]' field=null getter='public final fun <get-test8> (): IrErrorType declared in <root>.C' setter='public final fun <set-test8> (<set-?>: IrErrorType): kotlin.Unit declared in <root>.C' type=kotlin.reflect.KMutableProperty1<*, *> origin=PROPERTY_REFERENCE_FOR_DELEGATE
|
||||
GET_VAR '<set-?>: IrErrorType declared in <root>.C.<set-test8>' type=IrErrorType origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
|
||||
@@ -54,7 +54,8 @@ FILE fqName:<root> fileName:/delegatedProperties.kt
|
||||
CALL 'public final fun getValue <T> (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): T of kotlin.getValue [inline,operator] declared in kotlin' type=kotlin.Int origin=null
|
||||
<T>: kotlin.Int
|
||||
$receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test2$delegate type:kotlin.Lazy<kotlin.Int> visibility:private [final]' type=kotlin.Lazy<kotlin.Int> origin=null
|
||||
thisRef: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
||||
receiver: GET_VAR '<this>: <root>.C declared in <root>.C.<get-test2>' type=<root>.C origin=null
|
||||
thisRef: GET_VAR '<this>: <root>.C declared in <root>.C.<get-test2>' type=<root>.C origin=null
|
||||
property: PROPERTY_REFERENCE 'public final test2: kotlin.Int [delegated,val]' field=null getter='public final fun <get-test2> (): kotlin.Int declared in <root>.C' setter=null type=kotlin.reflect.KProperty1<<root>.C, kotlin.Int> origin=PROPERTY_REFERENCE_FOR_DELEGATE
|
||||
PROPERTY name:test3 visibility:public modality:FINAL [delegated,var]
|
||||
FIELD PROPERTY_DELEGATE name:test3$delegate type:kotlin.collections.MutableMap<kotlin.String, kotlin.Any> visibility:private [final]
|
||||
@@ -66,7 +67,7 @@ FILE fqName:<root> fileName:/delegatedProperties.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test3> (): IrErrorType declared in <root>.C'
|
||||
ERROR_CALL 'Unresolved reference: <Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#' type=IrErrorType
|
||||
GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
||||
GET_VAR '<this>: <root>.C declared in <root>.C.<get-test3>' type=<root>.C origin=null
|
||||
PROPERTY_REFERENCE 'public final test3: IrErrorType [delegated,var]' field=null getter='public final fun <get-test3> (): IrErrorType declared in <root>.C' setter='public final fun <set-test3> (<set-?>: IrErrorType): kotlin.Unit declared in <root>.C' type=kotlin.reflect.KMutableProperty1<*, *> origin=PROPERTY_REFERENCE_FOR_DELEGATE
|
||||
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-test3> visibility:public modality:FINAL <> ($this:<root>.C, <set-?>:IrErrorType) returnType:kotlin.Unit
|
||||
correspondingProperty: PROPERTY name:test3 visibility:public modality:FINAL [delegated,var]
|
||||
@@ -74,7 +75,7 @@ FILE fqName:<root> fileName:/delegatedProperties.kt
|
||||
VALUE_PARAMETER name:<set-?> index:0 type:IrErrorType
|
||||
BLOCK_BODY
|
||||
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#' type=IrErrorType
|
||||
GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
||||
GET_VAR '<this>: <root>.C declared in <root>.C.<set-test3>' type=<root>.C origin=null
|
||||
PROPERTY_REFERENCE 'public final test3: IrErrorType [delegated,var]' field=null getter='public final fun <get-test3> (): IrErrorType declared in <root>.C' setter='public final fun <set-test3> (<set-?>: IrErrorType): kotlin.Unit declared in <root>.C' type=kotlin.reflect.KMutableProperty1<*, *> origin=PROPERTY_REFERENCE_FOR_DELEGATE
|
||||
GET_VAR '<set-?>: IrErrorType declared in <root>.C.<set-test3>' type=IrErrorType origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
|
||||
@@ -99,7 +99,8 @@ FILE fqName:<root> fileName:/member.kt
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-testMember> (): kotlin.String declared in <root>.Host'
|
||||
CALL 'public final fun getValue (thisRef: kotlin.Any?, property: kotlin.Any?): kotlin.String [operator] declared in <root>.Delegate' type=kotlin.String origin=null
|
||||
$this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:testMember$delegate type:<root>.Delegate visibility:private [final]' type=<root>.Delegate origin=null
|
||||
thisRef: GET_VAR '<this>: <root>.Host declared in <root>.Host' type=<root>.Host origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Host declared in <root>.Host.<get-testMember>' type=<root>.Host origin=null
|
||||
thisRef: GET_VAR '<this>: <root>.Host declared in <root>.Host.<get-testMember>' type=<root>.Host origin=null
|
||||
property: PROPERTY_REFERENCE 'public final testMember: kotlin.String [delegated,val]' field=null getter='public final fun <get-testMember> (): kotlin.String declared in <root>.Host' setter=null type=kotlin.reflect.KProperty1<<root>.Host, kotlin.String> origin=PROPERTY_REFERENCE_FOR_DELEGATE
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
|
||||
+2
-2
@@ -73,8 +73,8 @@ FILE fqName:<root> fileName:/memberExtension.kt
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-plusK> (): kotlin.String declared in <root>.Host'
|
||||
CALL 'public final fun getValue (receiver: kotlin.String, p: kotlin.Any): kotlin.String [operator] declared in <root>.Host.StringDelegate' type=kotlin.String origin=null
|
||||
$this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:plusK$delegate type:<root>.Host.StringDelegate visibility:private [final]' type=<root>.Host.StringDelegate origin=null
|
||||
receiver: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Host
|
||||
receiver: ERROR_CALL 'Unresolved reference: this@R|/Host.plusK|' type=kotlin.String
|
||||
receiver: GET_VAR '<this>: <root>.Host declared in <root>.Host.<get-plusK>' type=<root>.Host origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Host declared in <root>.Host.<get-plusK>' type=<root>.Host origin=null
|
||||
p: PROPERTY_REFERENCE 'public final plusK: kotlin.String [delegated,val]' field=null getter='public final fun <get-plusK> (): kotlin.String declared in <root>.Host' setter=null type=kotlin.reflect.KProperty2<<root>.Host, kotlin.String, kotlin.String> origin=PROPERTY_REFERENCE_FOR_DELEGATE
|
||||
$this: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Host
|
||||
$receiver: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Host
|
||||
|
||||
@@ -262,7 +262,8 @@ FILE fqName:<root> fileName:/genericDelegatedDeepProperty.kt
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-deepO> (): T of <root>.<get-additionalText> declared in <root>.additionalText$delegate.<no name provided>'
|
||||
CALL 'public final fun getValue (t: <root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>, p: kotlin.reflect.KProperty<*>): T of <root>.<get-additionalText> declared in <root>.additionalText$delegate.<no name provided>.deepO$delegate.<no name provided>' type=T of <root>.<get-additionalText> origin=null
|
||||
$this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:deepO$delegate type:<root>.additionalText$delegate.<no name provided>.deepO$delegate.<no name provided> visibility:private [final]' type=<root>.additionalText$delegate.<no name provided>.deepO$delegate.<no name provided> origin=null
|
||||
t: ERROR_CALL 'Unresolved reference: this@R|/anonymous.deepO|' type=<root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>
|
||||
receiver: GET_VAR '<this>: <root>.additionalText$delegate.<no name provided> declared in <root>.additionalText$delegate.<no name provided>.<get-deepO>' type=<root>.additionalText$delegate.<no name provided> origin=null
|
||||
t: GET_VAR '<this>: <root>.additionalText$delegate.<no name provided> declared in <root>.additionalText$delegate.<no name provided>.<get-deepO>' type=<root>.additionalText$delegate.<no name provided> origin=null
|
||||
p: PROPERTY_REFERENCE 'private final deepO: T of <root>.<get-additionalText> [delegated,val]' field=null getter='public final fun <get-deepO> (): T of <root>.<get-additionalText> declared in <root>.additionalText$delegate.<no name provided>' setter=null type=kotlin.reflect.KProperty2<<root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>, <root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>, T of <root>.<get-additionalText>> origin=PROPERTY_REFERENCE_FOR_DELEGATE
|
||||
PROPERTY name:deepK visibility:private modality:FINAL [delegated,val]
|
||||
FIELD PROPERTY_DELEGATE name:deepK$delegate type:<root>.additionalText$delegate.<no name provided>.deepK$delegate.<no name provided> visibility:private [final]
|
||||
@@ -292,7 +293,8 @@ FILE fqName:<root> fileName:/genericDelegatedDeepProperty.kt
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-deepK> (): T of <root>.<get-additionalText> declared in <root>.additionalText$delegate.<no name provided>'
|
||||
CALL 'public final fun getValue (t: <root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>, p: kotlin.reflect.KProperty<*>): T of <root>.<get-additionalText> declared in <root>.additionalText$delegate.<no name provided>.deepK$delegate.<no name provided>' type=T of <root>.<get-additionalText> origin=null
|
||||
$this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:deepK$delegate type:<root>.additionalText$delegate.<no name provided>.deepK$delegate.<no name provided> visibility:private [final]' type=<root>.additionalText$delegate.<no name provided>.deepK$delegate.<no name provided> origin=null
|
||||
t: ERROR_CALL 'Unresolved reference: this@R|/anonymous.deepK|' type=<root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>
|
||||
receiver: GET_VAR '<this>: <root>.additionalText$delegate.<no name provided> declared in <root>.additionalText$delegate.<no name provided>.<get-deepK>' type=<root>.additionalText$delegate.<no name provided> origin=null
|
||||
t: GET_VAR '<this>: <root>.additionalText$delegate.<no name provided> declared in <root>.additionalText$delegate.<no name provided>.<get-deepK>' type=<root>.additionalText$delegate.<no name provided> origin=null
|
||||
p: PROPERTY_REFERENCE 'private final deepK: T of <root>.<get-additionalText> [delegated,val]' field=null getter='public final fun <get-deepK> (): T of <root>.<get-additionalText> declared in <root>.additionalText$delegate.<no name provided>' setter=null type=kotlin.reflect.KProperty2<<root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>, <root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>, T of <root>.<get-additionalText>> origin=PROPERTY_REFERENCE_FOR_DELEGATE
|
||||
FUN name:getValue visibility:public modality:FINAL <> ($this:<root>.additionalText$delegate.<no name provided>, t:<root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>, p:kotlin.reflect.KProperty<*>) returnType:<root>.P<T of <root>.<get-additionalText>, T of <root>.<get-additionalText>>
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.additionalText$delegate.<no name provided>
|
||||
|
||||
Reference in New Issue
Block a user